易截截图软件、单文件、免安装、纯绿色、仅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


相关文档:

css样式相关知识小结

可以放置样式的地方:样式表,<style>和style
样式表是一个独立的文件,可以通过<link>元素或者css的@import语句把它附加到某个html文档中,<style>是一个html元素,可以把它内嵌在html文档中,style是一个属性,可以内置在任何html元素中。
要想把样式表连到html文档中,要在html文档中的<head> ......

css竞争规则

竞争规则:css允许多次将同一个规则赋予某个元素。层叠排序根据规则中使用的选择符将规则划分6组,高优先级组里的规则会覆盖低优先级组里的规则。普通的选择符会设置文档的总体样式,更具体的选择符会覆盖普通选择符,以为其提供更加特殊的样式
6个选择符群组:
1.       使用!important规 ......

javascript &css实现的长文章分页

<!DOCTYPE HTML PUBLIC "-//W3C//DTD HTML 4.0 Transitional//EN">
<HTML>
<HEAD>
<TITLE>FLYSO Blog-- JS代码实现的自动分页效果~!</TITLE>
<META NAME="Generator" CONTENT="EditPlus">
<META NAME="Author" CONTENT=""& ......

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:border width

语法:
 
border-width : medium | thin | thick | length
 
参数:
 
medium :  默认宽度
thin :  小于默认宽度
thick :  大于默认宽度
length :  由浮点数字和单位标识符组成的长度值。不可为负值。请参阅长度单位
 
说明:
 
如果提供全部四个参数值,将按上-右-下-左的顺 ......
© 2009 ej38.com All Rights Reserved. 关于E健网联系我们 | 站点地图 | 赣ICP备09004571号