位置改變樣式就變了
<!DOCTYPE html PUBLIC "-//W3C//DTD XHTML 1.0 Transitional//EN" "http://www.w3.org/TR/xhtml1/DTD/xhtml1-transitional.dtd">
<html xmlns="http://www.w3.org/1999/xhtml">
<head>
<meta http-equiv="Content-Type" content="text/html; charset=utf-8" />
<title>無標(biāo)題文檔</title>
<style type="text/css">
*{margin:0px; padding:0px;}
.concent{border:1px solid #0F0;padding:44px 15px 15px; width:730px;}
.book{background:url(case2/images/t_book.gif) no-repeat;background-color:#CCC;}
img{margin:12px 18px; border:1px solid #CCC;}
</style>
</head>
<body>
<div class="concent book">
<!--<ing>是行級元素所以每個標(biāo)簽不單獨占行-->
<img src="case2/images/book1.jpg" width="80" height="80"/>
<img src="case2/images/book2.jpg" width="80" height="80"/>
<img src="case2/images/book3.jpg" width="80" height="80"/>
<img src="case2/images/book4.jpg" width="80" height="80"/>
<img src="case2/images/book5.jpg" width="80" height="80"/>
</div>
</body>
</html>
為什么#CCC;這個屬性值放在content中顏色就顯示不出來,而放在book中就顯示出來了
2016-12-08
因為.book中已經(jīng)定義了background,如果放在book中,后面就是#ccc,后面的屬性覆蓋前面的同名屬性;
如果放在content中,也是后面的屬性覆蓋前面的同名屬性,但后面的屬性是url(圖片)了