易截截图软件、单文件、免安装、纯绿色、仅160KB

CSS Containing Floats

原文网址:http://www.complexspiral.com/publications
Containing Floats
As powerful and useful as they are, floats can make for tricky layout tools. Chances are that you may have seen something like the situation shown in Figure 1, which is accomplished with just two div elements, each with a floated image inside it.
Figure 1. That's not right!
This is probably not what the author had in mind, but given the styles used, it's the correct layout. Here's how we created it:
div.item {border: 1px solid; padding: 5px;}
div.item img {float: left; margin: 5px;}
That's all it takes. The result seen in Figure 1 happens because the div elements don't "stretch" to contain the floated images within them. To look at the situation from the reverse angle, it happens because the floated images "stick out" of the bottom of the div elements.
This is not a bug. It's also not a flaw in CSS. It is, in fact, the behavior that most authors will want most of the time. It's just not what they would want in the example shown in Figure 1.
Understanding the Problem
So when in the name of all that's good and right would authors want floats to stick out of their containing elements? Simple: in what is historically the most common case for float use. Consider Figure 2, and the basic markup structure that produced it.
Figure 2. Floating an image, flowing the text.
<p>
 ...text...
 <img src="jul31-03-sm.jpg" height="200" border="0" class="picture">
 ...text...
</p>
<p>
 ...text...
</p>
The practice of flowing text around an image goes back a long, long time. That's why the ability was added to the Web starting with Netscape 1.1, and why CSS makes it possible using the property float.[1] But look closely at Figure 2. The floated image is sticking out of its containing element. We can see this more clearly by adding borders to the paragraphs, as shown in Figure 3.
Figure 3. Adding borders to the paragraphs.
So now we can se


相关文档:

net 后台设置div的css属性,设置style

前台div
Html代码
<div id="DIV1" runat="server" >  
</div>  
后台:
C#代码
this.DIV1.Style.Value = "display:none";  
或者:
C#代码
DIV1.Attributes.CssStyle.Value = "display:none";  
......

【摘自网易博客】FireFox与IE中CSS兼容技术集绵整理

1.css在不同浏览器下显示效果不同
firefox和IE对某些css样式的认定有不少区别,包括:
·                            ul和ol的默认padding值是不一样的,在Firefox中, ......

ie8 css float问题

#weblmenu
{
height:22px;
width:700px;
float:left;
display:inline;
text-align:left;
}
#weblmenu ul
{
height:22px;
width:700px;
text-align:left;
float:left;
}
#weblmenu ul li
{
height:22px;
width:110px;
float:left;
list-style-type:none;
text-align:center;
word-break:break-all;
} ......

字符串截取问题 css截取字符串注意事项

<div class="llist" >
<div class="lbar">定向营销</div>
<ul class="lbox01" style="height: auto;min-height: 100px;">
<c:forEach var="item" items="${marketInfos.results}">
<li><div style="overflow:hidden; text-overfl ......

css選擇符大雜燴

 
类型选择符:单指元素的名字,而没有大于号和小于号
类选择符:选择所有赋有相同类的元素 一个点号后面跟类名,类选择符要跟着类名的后面。 可以把加在通配符*的后面来选择文档中所有赋予该类的元素,
Id 选择符
 
群组选择符:多个选择符用逗号连起来
后代选择符:多个选择符用空白连起来
子选择符:多 ......
© 2009 ej38.com All Rights Reserved. 关于E健网联系我们 | 站点地图 | 赣ICP备09004571号