CSS Float 浮动方式
CSS Float 浮动方式,我们可以用float来设置当前div p 等窗口的对齐方式的如float:left就代表向左边哦.
浮动是经常被用来推动一个形象一方或另一方,而有文字的总结段周围。这种类型的应用通常被称为文字环绕和类似于你会看到许多杂志有文章,总结各地的各种图像形状和大小。
浮法图像
包装文字图片时,很容易使用的CSS浮法属性。你有一个选择,要么浮动图片的左边或右边,其余的是替您完成了。下面是一个例子,一个形象,是最常用的不同方面的一个段落。
img.floatLeft {
float: left;
margin: 4px;
}
img.floatRight {
float: right;
margin: 4px;
}
html实例代码.
<body>
<img src="sunset.gif" class="floatLeft">
<p>The images are contained with...</p>
<img src="sunset.gif" class="floatRight">
<p>This second paragraph has an...</p>
如果你仅仅三个图像浮动的权利,他们将出现在彼此。如果你希望在未来的形象开始低于年底前图像,然后使用CSS清除属性。
img.floatRightClear {
float: right;
clear: right;
margin: 4px;
}
<body>
<img src="sunset.gif" class="floatRightClear">
<img src="sunset.gif" class="floatRightClear">
<p>The images are appearing...</p>
<p>If we had specified...</p>
<p>The number of paragraphs...</p>
</body>
</body>
补充:Css教程,CSS入门