web标准:CSS clear的属性及使用方法

来源:中国设计秀 时间:2008-10-27 13:31:00 

Image and text elements that appear in another element are called floating elements. The clear property sets the sides of an element where other floating elements are not allowed.

图片和文字元素出现在另外元素中,那么它们(图片和文字)可称为浮动元素(floating element)。使用clear属性可以让元素边上不出现其它浮动元素。

Note: This property does not always work as expected if it is used along with the \"float\" property.

注意:当这个属性随着\"float\"属性一起使用的话,那么结果可能会不尽如人意

Inherited: No

继承性:

可用值

描述
leftNo floating elements allowed on the left side
不允许元素左边有浮动的元素
rightNo floating elements allowed on the right side
不允许元素的右边有浮动的元素
bothNo floating elements allowed on either the left or the right side
元素的两边都不允许有浮动的元素
noneAllows floating elements on both sides
允许元素两边都有浮动的元素

举例


<style type=\"text/css\">
.LeftText{
   margin: 3px;
   float: left;
   height: 180px;
   width: 170px;
   border: 1px solid #B1D1CE;
   background-color: #F3F3F3;
}
.FootText{
   height: 180px;
}
.Clear
{
   clear:both;
}
</style>
<div class=\"LeftText\">区块1</div>
<div class=\"LeftText\">区块2</div>
<div class=\"Clear\"></div>
<div class=\"FootText\">区块3</div>

代码说明:

如果没有Clear这一层,“区块3”会紧接区块2并列在同一行。

加了Clear这一层后,会把上面的浮动DIV的影响清除,使其不至影响下面DIV的布局

标签:clear,web标准,属性,方法
0
投稿

猜你喜欢

  • 网页模式化窗口

    2008-04-27 20:52:00
  • IE地址栏显示网站图标制作方法

    2007-10-13 11:08:00
  • css样式命名规则

    2008-04-30 12:31:00
  • asp 防盗链代码(彻底屏蔽迅雷,旋风,快车下载站内资源)

    2011-02-26 10:46:00
  • ASP3.0中的流控制能力

    2008-10-19 17:41:00
  • 判断数据库里存在的BIG5码

    2009-04-09 18:31:00
  • 什么是好的设计

    2010-02-25 12:22:00
  • 归纳万恶IE6的HACK方法

    2010-02-04 17:17:00
  • XML与HTML的结合(下)

    2008-09-05 17:20:00
  • 960px下的黄金分割

    2009-07-31 14:33:00
  • SQL Server小知识:Processor Affinity

    2008-11-24 20:50:00
  • 在SQL Server 2008中安装安全审计

    2009-02-24 17:22:00
  • Mootools常用方法扩展(一)

    2009-01-09 12:45:00
  • WEB移动应用框架构想

    2010-09-28 16:26:00
  • asp中Access与Sql Server数据库区别总结

    2007-11-18 15:08:00
  • 修改Linux下MySQL 5.0的默认连接数

    2009-09-01 10:16:00
  • HTML5 声明兼容IE的写法

    2011-06-06 10:34:00
  • SQL Server数据库连接查询的种类及其应用

    2009-01-06 11:28:00
  • php基础字符串与数组知识点讲解

    2023-05-25 08:28:14
  • jQuery 取得 background-position 的值

    2009-04-05 16:02:00
  • asp之家 网络编程 m.aspxhome.com