外部样式表
<html>
<head>
<title>css入门</title>
<link rel="stylesheet" type="text/css" href="basic.css"/>
</head>
<body>
<div id="logo">flash</div>
<div id="banner">宣传画</div>
<div id="nav">导航</div>
<div id="hot">
<h1>热点新闻</h1>
</div>
<div id="content">主要内容</div>
<div id="intro">介绍</div>
<div id="footer">版权</div>
</body>
</html>
css代码
* {
margin:0;
padding:0;
}
body {
width:760px;
margin:0 auto;
font-size:12px;
}
ul {
list-style-type:none;
}
#logo {
width:760px;
height:190px;
background-color:red;
}
#banner {
width:760px;
height:40px;
margin-bottom:10px;
background-color:blue;
}
#nav {
width:760px;
height:60px;
margin-bottom:10px;
background:yellow;
}
#hot {
width:250px;
height:226px;
margin-bottom:10px;
background:yellow;
float:right;
}
#intro {
width:250px;
height:100px;
margin-bottom:10px;
background:pink;
float:right;
}
#content {
width:500px;
height:336px;
margin-bottom:10px;
background:purple;
float:left;
}
#footer {
clear:both;
width:760px;
height:120px;
background:rgb(255,255,0);
}