如图:style中所写 div banner 下的img 属性没有生效,body的属性未生效但其他div标签属性生效
网站目录如下
<!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>个人空间</title>
<link rel="stylesheet" type="text/css" href="style/style.css"/>
</head>
<body>
<div id="top"></div>
<div id="nav"></div>
<div id="banner">
<img src="image/9.png" width="150" height="150" />
<div class="banner_right">
</div>
</div>
<div id="contet" >
<div class="content_left"></div>
<div class="content_right">
大家好欢迎来到我的网站。
</div>
</div>
<div id="footer"></div>
</body>
</html>
<style type="text/css"> body{ margin: 0; padding: 0; font-size: 24px; text-align: center; background-color: #111; background-image:url(../image/body-background.jpg); background-attachment:fixed; background-repeat: no-repeat; } #top{ width:980px; height:0px; background-color:#CCC; margin:0 auto; } #nav{ width:980px; height:0px; background-color:#ccc; margin: 5px auto; } #banner{ width: 980px; height: 200px; background-color: #222; margin: 0 auto; } .banner_left{ width: 200px; height: 200px; background-color: #333; float: left; } .banner_right{ width:775px; height:200px; background-color:#333; float:right; } #icon{ width:150px; height:150px; position:relative; left:25px; top:25px; overflow:hidden; } #contet{ width:980px; height:auto; margin:5px auto; overflow:hidden; } .content_left{ width:250px; height:500px; background-color:#333; float:left; } .content_right{ width:725px; height:auto; background-color:#333; float:right; } #footer{ width:980px; height:120px; background-color:#333; margin:0 auto; } #Navigate{ } #banner.img{ position: absolute; right: 20px; border: 2px solid #ccc; top: 20px; } </style>
qq_安安_17