學習中的點滴
1、需要把 background-attachment 屬性設置為 "fixed",才能保證該屬性在 Firefox 和 Opera 中正常工作。
例子:
<html>
<head>
<style type="text/css">
body
{
background-image:url('eg_bg_03.gif');
background-repeat:no-repeat;
background-position:center;
background-attachment:fixed;
}
</style>
</head>
<body>
</body>
</html>
2、
clear:both
CSS中 clear:both;可以終結在出現他之前的浮動
語法: clear : none | left |right | both
參數:
none : 允許兩邊都可以有浮動對象
both : 不允許有浮動對象
left : 不允許左邊有浮動對象
right : 不允許右邊有浮動對象
說明: 該屬性的值指出了不允許有浮動對象的邊。請參閱float屬性。 對應的腳本特性為clear
示例:
div { clear : left }
img { float: right }
<div style="clear:both;"></div>
主要是用在div套div的結構中。如果內div是浮動的,一般都需要clear浮動,不然的話內div會超出外div的框架
所用什么時候用clear:both;就很重要,一般我們在需要清除浮動的時候用到clear:both;不要輕意用到clear:both;因為它也有副伯用.
我們寫一個clear:both;的例子:
<div style="float:left;width:100px;"> clear:both第1行第1列,</div>
<div style="float:left;width:700px;"> clear:both第1行第2列,</div>
<div style="clear:both;"> clear:both第2行。</div>
<div style="float:left;width:100px;"> 第1列,</div>
<div style="float:left;width:700px;"> 第2列,</div>
<div>第三列</div>
------------------------------------------------------------------------------------------------
<div style="float:left;width:100px;"> 第1列,</div>
<div style="float:left;width:700px;"> 第2列,</div>
<div style="clear:both;"></div>
<div>第三列</div>
3css疑難問題收集
posted on 2010-03-11 10:46 Angle Wang 閱讀(254) 評論(0) 編輯 收藏 所屬分類: CSS