pbootcms网站模板|日韩1区2区|织梦模板||网站源码|日韩1区2区|jquery建站特效-html5模板网

      • <bdo id='rmQBk'></bdo><ul id='rmQBk'></ul>

      <small id='rmQBk'></small><noframes id='rmQBk'>

    1. <legend id='rmQBk'><style id='rmQBk'><dir id='rmQBk'><q id='rmQBk'></q></dir></style></legend>
      <i id='rmQBk'><tr id='rmQBk'><dt id='rmQBk'><q id='rmQBk'><span id='rmQBk'><b id='rmQBk'><form id='rmQBk'><ins id='rmQBk'></ins><ul id='rmQBk'></ul><sub id='rmQBk'></sub></form><legend id='rmQBk'></legend><bdo id='rmQBk'><pre id='rmQBk'><center id='rmQBk'></center></pre></bdo></b><th id='rmQBk'></th></span></q></dt></tr></i><div class="5t7xzbn" id='rmQBk'><tfoot id='rmQBk'></tfoot><dl id='rmQBk'><fieldset id='rmQBk'></fieldset></dl></div>

      1. <tfoot id='rmQBk'></tfoot>

        浮動子元素:溢出:隱藏或清除:兩者?

        Floated Child Elements: overflow:hidden or clear:both?(浮動子元素:溢出:隱藏或清除:兩者?)
          <bdo id='gE1fL'></bdo><ul id='gE1fL'></ul>
          <legend id='gE1fL'><style id='gE1fL'><dir id='gE1fL'><q id='gE1fL'></q></dir></style></legend>

                  <tbody id='gE1fL'></tbody>
                <i id='gE1fL'><tr id='gE1fL'><dt id='gE1fL'><q id='gE1fL'><span id='gE1fL'><b id='gE1fL'><form id='gE1fL'><ins id='gE1fL'></ins><ul id='gE1fL'></ul><sub id='gE1fL'></sub></form><legend id='gE1fL'></legend><bdo id='gE1fL'><pre id='gE1fL'><center id='gE1fL'></center></pre></bdo></b><th id='gE1fL'></th></span></q></dt></tr></i><div class="xtlfl9z" id='gE1fL'><tfoot id='gE1fL'></tfoot><dl id='gE1fL'><fieldset id='gE1fL'></fieldset></dl></div>
              • <small id='gE1fL'></small><noframes id='gE1fL'>

                <tfoot id='gE1fL'></tfoot>

                  本文介紹了浮動子元素:溢出:隱藏或清除:兩者?的處理方法,對大家解決問題具有一定的參考價值,需要的朋友們下面隨著小編來一起學(xué)習(xí)吧!

                  問題描述

                  限時送ChatGPT賬號..

                  作為一名網(wǎng)絡(luò)開發(fā)人員,我經(jīng)常會在另一個(父)div 中放置兩個浮動(子)div.實際上我整天都在這樣做.

                  As a web developer I frequently will have two floated (child) divs inside of another (parent) div. Actually I do this all day long.

                  <style type="text/css">
                      #left {float:left;}
                      #right {float:right;}
                  </style>
                  <div id="parent">
                      <div id="left" class="child">&nbsp;</div>
                      <div id="right" class="child">&nbsp;</div>
                  </div>
                  

                  如果沒有額外的 css/html,這是行不通的,因為父級不會自動增長以適應(yīng)浮動的子級.有兩種流行的方法可以克服這個問題:
                  1) 將 overflow:hidden 添加到父級的 css 中.
                  2) 添加第三個清除"子 <br style="clear:both;"/>.

                  This doesn't work without an extra bit of css/html because the parent doesn't automatically grow to fit floated children. There are two popular ways of overcoming that:
                  1) Add overflow:hidden to the parent's css.
                  2) Add a 3rd "clearing" child <br style="clear:both;" />.

                  我知道關(guān)于這些事情還有其他一些類似的問題,但我的問題是:

                  I know there's a few other similar questions about such things, but my question is:

                  哪種方法更好,為什么?什么各有優(yōu)劣?

                  Which method is better and why? What are the pros and cons of each?

                  推薦答案

                  1. 隱藏溢出 - 非??煽康姆椒?主要缺點是如果您在父元素上設(shè)置高度,則任何溢出都將......嗯,隱藏.我在創(chuàng)建帶有浮動列表項的菜單時發(fā)現(xiàn)了這一點 - 子菜單不會出現(xiàn).

                  1. Hidden overflow - pretty solid method. The main disadvantage is if you set a height on the parent element, any overflow will be...well, hidden. I found this when creating a menu with floated list items - the submenus would not appear.

                  清除元素 - 而不是換行符,我會使用 height: 0; 的 divclear: both; 因為它不會在下面產(chǎn)生間隙.這是一種更可靠的方法,唯一的缺點是標記中的額外元素.

                  Clearing element - rather than a line break, I would use a div with height: 0; clear: both; since it won't create a gap below. This is a more solid method, the only disadvantage being an extra element in the markup.

                  浮動父元素 - 根據(jù)我的經(jīng)驗,有太多情況您不想浮動父元素,所以我會避免它.

                  Float the parent - in my experience there are too many situations where you don't want to float the parent element, so I would avoid it.

                  你也可以使用生成內(nèi)容的方法:

                  You can also use the generated content method:

                  #parent:after {
                    content: ".";
                    visibility: hidden;
                    clear: both;
                  }
                  

                  這樣可以節(jié)省標記中額外元素的需要,但在 IE7 及更低版本中不起作用.

                  This saves the need for an extra element in the markup, but it won't work in IE7 and below.

                  使用內(nèi)聯(lián)塊 - 剛剛記住了這個方法.不要浮動這兩列,而是將它們設(shè)置為 display: inline-block ,它們將并排顯示:

                  Use inline blocks - just remembered this method. Instead of floating the two columns, set them to display: inline-block and they will appear side-by-side:

                  .child {
                    display: inline-block;
                    vertical-align: top;
                  }
                  

                  使用此方法您必須記住的唯一一件事是,如果一個塊的結(jié)束標記和另一個塊的開始標記之間有空格,則列之間會出現(xiàn)一個空格(其大小取決于字體,因此很難來衡量).只要你這樣做 ...</div><div id=... 那么這個方法就可以正常工作并且優(yōu)于浮動元素 IMO.

                  Only thing you must remember with this method is if there is any whitespace between the close tag of one block and the opening tag of another, a space will appear between the columns (the size of which depends on the font so it difficult to gauge). As long as you do ...</div><div id=... then this method works fine and is superior to floating elements IMO.

                  這篇關(guān)于浮動子元素:溢出:隱藏或清除:兩者?的文章就介紹到這了,希望我們推薦的答案對大家有所幫助,也希望大家多多支持html5模板網(wǎng)!

                  【網(wǎng)站聲明】本站部分內(nèi)容來源于互聯(lián)網(wǎng),旨在幫助大家更快的解決問題,如果有圖片或者內(nèi)容侵犯了您的權(quán)益,請聯(lián)系我們刪除處理,感謝您的支持!

                  相關(guān)文檔推薦

                  Stylesheet not loaded because of MIME-type(由于 MIME 類型而未加載樣式表)
                  CSS3 Transition ( Vendor Prefixes) crashes Safari immediately(CSS3 過渡(供應(yīng)商前綴)立即使 Safari 崩潰)
                  @font-face crashes IE8(@font-face 讓 IE8 崩潰)
                  Remove formatting from a contentEditable div(從 contentEditable div 中刪除格式)
                  What#39;s the difference between lt;taggt;lt;/taggt; and lt;tag /gt; in HTML?(lt;taggt;lt;/taggt; 有什么區(qū)別?和lt;標簽/gt;在 HTML 中?)
                  jquery limit text by length(jquery按長度限制文本)
                  <i id='24eEK'><tr id='24eEK'><dt id='24eEK'><q id='24eEK'><span id='24eEK'><b id='24eEK'><form id='24eEK'><ins id='24eEK'></ins><ul id='24eEK'></ul><sub id='24eEK'></sub></form><legend id='24eEK'></legend><bdo id='24eEK'><pre id='24eEK'><center id='24eEK'></center></pre></bdo></b><th id='24eEK'></th></span></q></dt></tr></i><div class="hjlbztv" id='24eEK'><tfoot id='24eEK'></tfoot><dl id='24eEK'><fieldset id='24eEK'></fieldset></dl></div>
                1. <tfoot id='24eEK'></tfoot>

                  <legend id='24eEK'><style id='24eEK'><dir id='24eEK'><q id='24eEK'></q></dir></style></legend>

                      <tbody id='24eEK'></tbody>
                    • <bdo id='24eEK'></bdo><ul id='24eEK'></ul>

                            <small id='24eEK'></small><noframes id='24eEK'>

                            主站蜘蛛池模板: 宿松新闻网 宿松网|宿松在线|宿松门户|安徽宿松(直管县)|宿松新闻综合网站|宿松官方新闻发布 | 番茄畅听邀请码怎么输入 - Dianw8.com | 大倾角皮带机-皮带输送机-螺旋输送机-矿用皮带输送机价格厂家-河南坤威机械 | 西安标准厂房_陕西工业厂房_西咸新区独栋厂房_长信科技产业园官方网站 | 长沙发电机-湖南发电机-柴油发电机供应厂家-长沙明邦智能科技 | 电地暖-电采暖-发热膜-石墨烯电热膜品牌加盟-暖季地暖厂家 | 硅胶制品-硅橡胶制品-东莞硅胶制品厂家-广东帝博科技有限公司 | 赛默飞Thermo veritiproPCR仪|ProFlex3 x 32PCR系统|Countess3细胞计数仪|371|3111二氧化碳培养箱|Mirco17R|Mirco21R离心机|仟诺生物 | 云南丰泰挖掘机修理厂-挖掘机维修,翻新,再制造的大型企业-云南丰泰工程机械维修有限公司 | 水轮机密封网 | 水轮机密封产品研发生产厂家 | 海南在线 海南一家| cnc精密加工_数控机械加工_非标平键定制生产厂家_扬州沃佳机械有限公司 | 大型冰雕-景区冰雕展制作公司,3D创意设计源头厂家-[赛北冰雕] | 蓄电池在线监测系统|SF6在线监控泄露报警系统-武汉中电通电力设备有限公司 | 起好名字_取个好名字_好名网免费取好名在线打分 | 盘扣式脚手架-附着式升降脚手架-移动脚手架,专ye承包服务商 - 苏州安踏脚手架工程有限公司 | 信阳网站建设专家-信阳时代网联-【信阳网站建设百度推广优质服务提供商】信阳网站建设|信阳网络公司|信阳网络营销推广 | 贵州水玻璃_-贵阳花溪闽兴水玻璃厂 | 鼓风干燥箱_真空烘箱_高温干燥箱_恒温培养箱-上海笃特科学仪器 | 底部填充胶_电子封装胶_芯片封装胶_芯片底部填充胶厂家-东莞汉思新材料 | 镀锌钢格栅_热镀锌格栅板_钢格栅板_热镀锌钢格板-安平县昊泽丝网制品有限公司 | 上海单片机培训|重庆曙海培训分支机构—CortexM3+uC/OS培训班,北京linux培训,Windows驱动开发培训|上海IC版图设计,西安linux培训,北京汽车电子EMC培训,ARM培训,MTK培训,Android培训 | 暖气片十大品牌厂家_铜铝复合暖气片厂家_暖气片什么牌子好_欣鑫达散热器 | 客服外包专业服务商_客服外包中心_网萌科技 | 定制/定做冲锋衣厂家/公司-订做/订制冲锋衣价格/费用-北京圣达信 | 色油机-色母机-失重|称重式混料机-称重机-米重机-拌料机-[东莞同锐机械]精密计量科技制造商 | 液氮罐(生物液氮罐)百科-无锡爱思科 | 生鲜配送系统-蔬菜食材配送管理系统-连锁餐饮订货配送软件-挪挪生鲜供应链管理软件 | 27PR跨境电商导航 | 专注外贸跨境电商 | 深圳离婚律师咨询「在线免费」华荣深圳婚姻律师事务所专办离婚纠纷案件 | 精密冲床,高速冲床等冲压设备生产商-常州晋志德压力机厂 | 校园文化空间设计-数字化|中医文化空间设计-党建|法治廉政主题文化空间施工-山东锐尚文化传播公司 | 船用锚链|专业锚链生产厂家|安徽亚太锚链制造有限公司 | 胜为光纤光缆_光纤跳线_单模尾纤_光纤收发器_ODF光纤配线架厂家直销_北京睿创胜为科技有限公司 - 北京睿创胜为科技有限公司 | 广州云仓代发-昊哥云仓专业电商仓储托管外包代发货服务 | 挤奶设备过滤纸,牛奶过滤纸,挤奶机过滤袋-济南蓝贝尔工贸有限公司 | 聚合氯化铝价格_聚合氯化铝厂家_pac絮凝剂-唐达净水官网 | 层流手术室净化装修-检验科ICU改造施工-华锐净化工程-特殊科室建设厂家 | 运动木地板厂家,篮球场木地板品牌,体育场馆木地板安装 - 欧氏运动地板 | 电动高尔夫球车|电动观光车|电动巡逻车|电动越野车厂家-绿友机械集团股份有限公司 | 阿米巴企业经营-阿米巴咨询管理-阿米巴企业培训-广东键锋企业管理咨询有限公司 |