{"id":199353,"date":"2025-05-03T11:07:16","date_gmt":"2025-05-03T03:07:16","guid":{"rendered":"https:\/\/server.hk\/cnblog\/199353\/"},"modified":"2025-05-03T11:07:16","modified_gmt":"2025-05-03T03:07:16","slug":"ecshop%e6%a8%a1%e6%9d%bfcss%e5%85%bc%e5%ae%b9%e6%80%a7%e9%97%ae%e9%a2%98_heightauto%e7%81%ab%e7%8b%90%e4%b8%8b%e6%97%a0%e6%95%88","status":"publish","type":"post","link":"https:\/\/server.hk\/cnblog\/199353\/","title":{"rendered":"ecshop\u6a21\u677fcss\u517c\u5bb9\u6027\u95ee\u9898_height:auto\u706b\u72d0\u4e0b\u65e0\u6548"},"content":{"rendered":"<p> \u4e0d\u53ea\u662f\u5728\u6a21\u677f\u4fee\u6539\u4e2d\u4f1a\u78b0\u5230\u6b64\u7c7b\u95ee\u9898\uff0c\u5728\u4efb\u4f55\u7684DIV+CSS\u9875\u9762\u5236\u4f5c\u4e2d\u90fd\u4f1a\u78b0\u5230\u3002<br \/> \u65e5\u524d\u672c\u7ad9\u957f\u5728\u5e2e\u670b\u53cb\u5236\u4f5cECSHOP\u6a21\u677f\u7684\u65f6\u5019\u5c31\u9047\u5230\u4e86\u8fd9\u4e2a\u517c\u5bb9\u6027\u95ee\u9898\u3002<br \/> \u6211\u5728\u6700\u5916\u5c42\u7684DIV\u8bbe\u7f6e\u4e86\u4e00\u4e2a heiht:auto&nbsp;\uff0c\u91cc\u9762\u8fd8\u6709\u4e24\u7ea7 div&nbsp;\uff0c\u5728IE\u4e0b\u5f88\u6b63\u5e38\uff0c\u6700\u5916\u5c42\u7684\u5927DIV\u4f1a\u968f\u7740\u5185\u90e8\u7684DIV\u7684\u9ad8\u5ea6\u800c\u53d8\u5316\uff0c\u4f46\u662f\u5728\u706b\u72d0\u4e0b\u5c31\u65e0\u6548\u3002&nbsp;<\/p>\n<p> Firefox\u7b49\u7b26\u5408W3C\u6807\u51c6\u7684\u6d4f\u89c8\u5668\u4e2d\uff0c\u5982\u679c\u6709\u4e00\u4e2aDIV\u4f5c\u4e3a\u5916\u90e8\u5bb9\u5668\uff0c\u5185\u90e8\u7684DIV\u5982\u679c\u8bbe\u7f6e\u4e86float\u6837\u5f0f\uff0c\u5219\u5916\u90e8\u7684\u5bb9\u5668DIV\u56e0\u4e3a\u5185\u90e8\u6ca1\u6709clear\uff0c\u5bfc\u81f4\u4e0d\u80fd\u88ab\u6491\u5f00\u3002<\/p>\n<p> \u4f8b\uff1a<\/p>\n<p> &lt;div style=&#8221; border:2px solid #0CC; width:600px;&#8221; &gt;<br \/> &nbsp;&lt;div style=&#8221; width:50px; height:600px; border:#099 1px solid; margin-left:5px; float:left;display:inline&#8221;&gt;&lt;\/div&gt;<br \/> &nbsp;&nbsp;&nbsp; &lt;div style=&#8221; width:50px; height:40px; border:#099 1px solid; margin-left:5px; float:left;display:inline &#8220;&gt;&lt;\/div&gt;<\/p>\n<p> &lt;div style=&#8221; width:50px; height:40px; border:#099 1px solid;float:right &#8220;&gt;&lt;\/div&gt;<br \/> &lt;!&#8211; &lt;div style=&#8221;clear:both&#8221;&gt;&lt;\/div&gt;&#8211;&gt;<br \/> &lt;\/div&gt;<\/p>\n<p> \u89e3\u51b3\u65b9\u6cd5\u5982\u4e0b\uff0c<\/p>\n<p> 1.<\/p>\n<p> &lt;div style=&#8221; border:2px solid #0CC; width:600px;&#8221; &gt;<br \/> &nbsp;&lt;div style=&#8221; width:50px; height:600px; border:#099 1px solid; margin-left:5px; float:left;display:inline&#8221;&gt;&lt;\/div&gt;<br \/> &nbsp;&nbsp;&nbsp; &lt;div style=&#8221; width:50px; height:40px; border:#099 1px solid; margin-left:5px; float:left;display:inline &#8220;&gt;&lt;\/div&gt;<\/p>\n<p> &lt;div style=&#8221; width:50px; height:40px; border:#099 1px solid;float:right &#8220;&gt;&lt;\/div&gt;<br \/> <font>&lt;div style=&#8221;clear:both&#8221;&gt;&lt;\/div&gt;&nbsp;&nbsp;&nbsp;&nbsp; <\/font><font>&lt;\/<\/font>div&gt;<\/p>\n<p> \u5728float:left\u7684Div\u4e4b\u540e \u52a0\u5165&lt;div style=&#8221;clear:both&#8221;&gt;&lt;\/div&gt;&nbsp; \u8fd9\u6837\u52a0\u5165\u7684\u5f0a\u7aef\u662f\uff0cJS DOM\u627e\u8282\u70b9\u65f6\u4f1a\u51fa\u73b0\u4e86\u4e00\u4e2a\u591a\u4f59\u7684\u8282\u70b9\uff0c\u8fd9\u4e2a\u4e5f\u662f\u4e2a\u6ca1\u7528\u7684DIv<\/p>\n<p> 2.\u76f4\u63a5\u5728\u6700\u5927\u5c42\u52a0\u5165 overflow:hidden; \u8fd9\u4e5f\u662f\u6211\u7528\u7684\u89e3\u51b3\u624b\u6cd5\uff01\uff01 \u7b80\u5355&#8211;<\/p>\n<p> &lt;div style=&#8221; border:2px solid #0CC; width:600px;<font>overflow:hidden;<\/font> &#8221; &gt;<br \/> &nbsp;&lt;div style=&#8221; width:50px; height:600px; border:#099 1px solid; margin-left:5px; float:left;display:inline&#8221;&gt;&lt;\/div&gt;<br \/> &nbsp;&nbsp;&nbsp; &lt;div style=&#8221; width:50px; height:40px; border:#099 1px solid; margin-left:5px; float:left;display:inline &#8220;&gt;&lt;\/div&gt;<\/p>\n<p> &lt;div style=&#8221; width:50px; height:40px; border:#099 1px solid;float:right &#8220;&gt;&lt;\/div&gt;<br \/> &lt;\/div&gt;<\/p>\n<p> 3.\u4eca\u5929\u7814\u7a76163\u4ee3\u7801\u7684\u65f6\u5019 \u4e5f\u53d1\u73b0\u4e00\u79cd\u65b0\u7684\u89e3\u51b3\u65b9\u6cd5 \u5c31\u662f\u52a0\u5165\u4e00\u4e2a\u4f2a\u7c7b\uff01<\/p>\n<p> &lt;div style=&#8221; border:2px solid #0CC; width:600px;&#8221; <font>class=&#8221;clearfix&#8221;<\/font>&nbsp;&gt;<br \/> &nbsp;&lt;div style=&#8221; width:50px; height:600px; border:#099 1px solid; margin-left:5px; float:left;display:inline&#8221;&gt;&lt;\/div&gt;<br \/> &nbsp;&nbsp;&nbsp; &lt;div style=&#8221; width:50px; height:40px; border:#099 1px solid; margin-left:5px; float:left;display:inline &#8220;&gt;&lt;\/div&gt;<\/p>\n<p> &lt;div style=&#8221; width:50px; height:40px; border:#099 1px solid;float:right &#8220;&gt;&lt;\/div&gt;<br \/> &lt;\/div&gt;<\/p>\n<p> Css\u5982\u4e0b\uff1a<\/p>\n<p> &lt;style&gt;<\/p>\n<p> .<font>clearfix:after{context:&#8221;.&#8221;; height:&#8221;0&#8243;; display:block;clear:both;visibility:hidden}<\/font><\/p>\n<p> \/* Hides from IE-mac \\*\/<br \/> <font>* html .clearfix {height: 1%;}<\/font><br \/> \/* End hide from IE-mac *\/<\/p>\n<p> &lt;\/style&gt;<\/p>\n<p> \u81f3\u4e8e\u8fd9\u79cd\u65b9\u6cd5\uff0cIE5.5\u4e0b \u5bf9\u6b64\u7c7b\u5e76\u4e0d\u652f\u6301\uff01\uff01<\/p>\n","protected":false},"excerpt":{"rendered":"<p>\u4e0d\u53ea\u662f\u5728\u6a21\u677f\u4fee\u6539\u4e2d\u4f1a\u78b0\u5230\u6b64\u7c7b\u95ee\u9898&#46;&#46;&#46;<\/p>\n","protected":false},"author":1,"featured_media":0,"comment_status":"closed","ping_status":"","sticky":false,"template":"","format":"standard","meta":{"footnotes":""},"categories":[4925],"tags":[],"class_list":["post-199353","post","type-post","status-publish","format-standard","hentry","category-4925"],"_links":{"self":[{"href":"https:\/\/server.hk\/cnblog\/wp-json\/wp\/v2\/posts\/199353","targetHints":{"allow":["GET"]}}],"collection":[{"href":"https:\/\/server.hk\/cnblog\/wp-json\/wp\/v2\/posts"}],"about":[{"href":"https:\/\/server.hk\/cnblog\/wp-json\/wp\/v2\/types\/post"}],"author":[{"embeddable":true,"href":"https:\/\/server.hk\/cnblog\/wp-json\/wp\/v2\/users\/1"}],"replies":[{"embeddable":true,"href":"https:\/\/server.hk\/cnblog\/wp-json\/wp\/v2\/comments?post=199353"}],"version-history":[{"count":0,"href":"https:\/\/server.hk\/cnblog\/wp-json\/wp\/v2\/posts\/199353\/revisions"}],"wp:attachment":[{"href":"https:\/\/server.hk\/cnblog\/wp-json\/wp\/v2\/media?parent=199353"}],"wp:term":[{"taxonomy":"category","embeddable":true,"href":"https:\/\/server.hk\/cnblog\/wp-json\/wp\/v2\/categories?post=199353"},{"taxonomy":"post_tag","embeddable":true,"href":"https:\/\/server.hk\/cnblog\/wp-json\/wp\/v2\/tags?post=199353"}],"curies":[{"name":"wp","href":"https:\/\/api.w.org\/{rel}","templated":true}]}}