<?xml version="1.0" encoding="UTF-8" ?>
<rss version="2.0">
<channel>
<title><![CDATA[Heck's  Blog]]></title> 
<link>https://www.heckjj.com/index.php</link> 
<description><![CDATA[一瞬间的决定，往往可以改变很多，事实上，让自己成功的往往不是知识，是精神！ 如果你总是为自己找借口，那只好让成功推迟。执行力，今天！]]></description> 
<language>zh-cn</language> 
<copyright><![CDATA[Heck's  Blog]]></copyright>
<item>
<link>https://www.heckjj.com/div-parent-container-self-opening/</link>
<title><![CDATA[如何解决Div父容器不根据内容自动撑开、自适应的问题]]></title> 
<author>Heck &lt;@hecks.tk&gt;</author>
<category><![CDATA[前端开发]]></category>
<pubDate>Mon, 20 Sep 2010 05:51:32 +0000</pubDate> 
<guid>https://www.heckjj.com/div-parent-container-self-opening/</guid> 
<description>
<![CDATA[ 
	<span style="font-family: 微软雅黑;">Div即父容器不根据内容自适应高度，我们看下面的代码：<br/>程序代码<br/>&lt;div id=&quot;main&quot;&gt;<br/>&lt;div id=&quot;content&quot;&gt;&lt;/div&gt;<br/>&lt;/div&gt;<br/><br/>当Content内容多时，即使main设置了高度100%或auto。在不同浏览器下还是不能完好的自动伸展。内容的高度比较高了，但容器main的高度还是不能撑开。<br/>我们可以通过三种方法来解决这个问题。<br/>一，增加一个清除浮动，让父容器知道高度。请注意，清除浮动的容器中有一个空格。<br/>程序代码&lt;div id=&quot;main&quot;&gt; <br/>&lt;div id=&quot;content&quot;&gt;&lt;/div&gt; <br/>&lt;div style=&quot;font: 0px/0px sans-serif;clear: both;display: block&quot;&gt; &lt;/div&gt; <br/>&lt;/div&gt;</span><span style="font-family: 微软雅黑;"><br/><br/>二，增加一个容器，在代码中存在，但在视觉中不可见。<br/>程序代码&lt;div id=&quot;main&quot;&gt; <br/>&lt;div id=&quot;content&quot;&gt;&lt;/div&gt; <br/>&lt;div style=&quot;height:1px; margin-top:-1px;clear: both;overflow:hidden;&quot;&gt;&lt;/div&gt;<br/>&lt;/div&gt; <br/><br/>三，增加一个BR并设置样式为clear:both。<br/>程序代码&lt;div id=&quot;main&quot;&gt; <br/>&lt;div id=&quot;content&quot;&gt;&lt;/div&gt; <br/>&lt;br style=&quot;clear:both;&quot; /&gt;<br/>&lt;/div&gt;&nbsp;&nbsp; </span><br/>Tags - <a href="https://www.heckjj.com/tags/div%25E8%2587%25AA%25E5%258A%25A8%25E6%2592%2591%25E5%25BC%2580/" rel="tag">div自动撑开</a> , <a href="https://www.heckjj.com/tags/div%25E7%2588%25B6%25E5%25AE%25B9%25E5%2599%25A8/" rel="tag">div父容器</a>
]]>
</description>
</item><item>
<link>https://www.heckjj.com/div-parent-container-self-opening/#blogcomment</link>
<title><![CDATA[[评论] 如何解决Div父容器不根据内容自动撑开、自适应的问题]]></title> 
<author> &lt;user@domain.com&gt;</author>
<category><![CDATA[评论]]></category>
<pubDate>Thu, 01 Jan 1970 00:00:00 +0000</pubDate> 
<guid>https://www.heckjj.com/div-parent-container-self-opening/#blogcomment</guid> 
<description>
<![CDATA[ 
	
]]>
</description>
</item>
</channel>
</rss>