什么是style =“clear:both”的用法? [英] What is the use of style="clear:both"?
本文介绍了什么是style =“clear:both”的用法?的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!
问题描述
我碰巧看到一个 div
,其风格 clear:both
! style
<$ p 使用
clear
$ p> < div style =clear:both>
解决方案
code>使元素低于文档中之前的任何浮动元素。
您也可以使用 clear:left
或
clear:right
,使其仅显示已向左或向右浮动的元素。
+ ------------ + + -------------------- +
| | | |
| float:left | |无明确
| | | |
| | + -------------------- +
| | + -------------------- +
| | | |
| | |与清楚:右|
| | | (在这里没有效果,|
| | |因为没有|
| | | float:right |
| | | element)
| | | |
| | + -------------------- +
| |
+ ------------ +
+ --------------------- +
| |
|与clear:left |
|或清除:两个|
| |
+ --------------------- +
I happened to see a div
which had the style clear:both
! What is the use of clear
in style
?
<div style="clear:both">
解决方案
clear:both
makes the element drop below any floated elements that precede it in the document.
You can also use clear:left
or clear:right
to make it drop below only those elements that have been floated left or right.
+------------+ +--------------------+
| | | |
| float:left | | without clear |
| | | |
| | +--------------------+
| | +--------------------+
| | | |
| | | with clear:right |
| | | (no effect here, |
| | | as there is no |
| | | float:right |
| | | element) |
| | | |
| | +--------------------+
| |
+------------+
+---------------------+
| |
| with clear:left |
| or clear:both |
| |
+---------------------+
这篇关于什么是style =“clear:both”的用法?的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!
查看全文