clear 清除浮动
浮动元素顾名思义就是浮动在版面之上,所以如果接着顺序往下写的程序码没有使用clear清除浮动的话,画面会重叠,如果後面的元素不打算做浮动元素的话,可以写上clear语法
比如说
<div class="header">表头</div>
<div class="menu">选单</div>
<div class="content">内容</div>
<div class="footer">页底</div>
CSS
.header{
height: 50px;
width: 800px;
background-color: blue;
}
.menu{
height: 50px;
width: 300px;
background-color:green;
float:left;
}
.content{
height: 50px;
width: 300px;
background-color:red;
float:left;
}
.footer{
height: 60px;
width: 800px;
background-color: yellow;
}
以上是没有使用clear语法的程序码,结果会如下图
<div class="header">表头</div>
<div class="menu">选单</div>
<div class="content">内容</div>
<div class="clearfix"></div>
<div class="footer">页底</div>
CSS
.header{
height: 50px;
width: 800px;
background-color: blue;
}
.menu{
height: 50px;
width: 300px;
background-color:green;
float:left;
}
.content{
height: 50px;
width: 300px;
background-color:red;
float:left;
}
.clearfix{
clear: both;
}
.footer{
height: 60px;
width: 800px;
background-color: yellow;
}
以上是使用clear语法的程序码,结果如下图
<<: Consistency and Consensus (3-1) - Ordering Guarantees
企业责任不只是说降低失业率而已,对於给金钱和时间,让员工进修也格外重要,倒不一定就是去大学修学分或拿...
大家好,我是韦恩,今天是铁人赛的第二十九天,今天我们会来练习language命名空间下的api,使用...
今天继续 todo app part2, 会纪录实作上遇到的问题。 若有错误,欢迎留言指教,感恩的...
再写登入的验证及功能 今天我们要来做登入的判断跟动作, 我们在HomeController.php引...
卖了那麽多天关子的最後实作,今天就要揭晓我们的题目了:不知道大家有没有玩过前些年很火红的一款小游戏呢...