1、网页结构分析,归纳出基本布局框架;
1.1、页面整体从上至下分为头部、导航、搜索、主体、底部组成;
1.2、主体部分又分为左边的内容区域与右边的边栏区域;
1.3、主体部分包含的几种结构提取出来设置公共样式类;
2、用div将整体页面框架划分好
3、提取公共样式,如:背景渐变色,最大程度适配各浏览器
4、部分代码:
index.html
[HTML] 纯文本查看 复制代码 <!DOCTYPE html>
<html>
<head>
<title>电子商务网站模板</title>
<meta charset="utf-8"/>
<link rel="stylesheet" href="css/style.css"/>
<script src="js/jquery-1.12.0.min.js"></script>
<script>
</script>
</head>
<body>
<div id="header" class="gradient"></div>
<div id="nav"></div>
<div id="search"></div>
<div class="content">
<div class="main">
<div class="clear">
<div class="section fl"></div>
<div class="options fr"></div>
</div>
<div class="main_ad"></div>
<div class="clear">
<div class="section fl"></div>
<div class="section fr"></div>
</div>
<div class="clear">
<div class="options fl"></div>
<div class="section fr"></div>
</div>
<div class="main_ad"></div>
<div class="clear">
<div class="section fl"></div>
<div class="section fr"></div>
</div>
<div class="clear">
<div class="section fl"></div>
<div class="section fr"></div>
</div>
</div>
<div class="side">
<div class="side_section"></div>
<div class="side_ad"></div>
<div class="side_ad"></div>
<div class="side_section"></div>
<div class="side_section"></div>
<div class="side_section"></div>
<div class="side_section"></div>
<div class="side_section"></div>
</div>
</div>
<div id="footer"></div>
</body>
</html> style.css[CSS] 纯文本查看 复制代码 /* style reset */
body,h1,h2,h3,h4,p,ul,ol,form,input,textarea,th,td,select{margin: 0;padding: 0;}
em{font-style: normal;}
li{list-style: none;}
a{text-decoration: none;}
img{border: none;vertical-align: top;}
table{border-collapse: collapse;}
input,textarea{outline: none;}
textarea{resize: none;overflow: auto;}
body{font-size: 12px;}
/* public */
.clear{zoom:1;}
.clear:after{content: '';display: block;clear: both}
.fl{float: left;}
.fr{float: right;}
.gradient{
background: -webkit-linear-gradient(top,#ffffff,#f8f8f8);
background: -moz-linear-gradient(top,#ffffff,#f8f8f8);
background: -ms-linear-gradient(top,#ffffff,#f8f8f8);
background: linear-gradient(top,#ffffff,#f8f8f8);
+background:#f9f9f9;
}
/* layout */
#header{width:960px; height: 30px; margin: 0 auto; border-radius: 0 0 6px 6px;}
#nav{}
#search{}
.content{}
.main{}
.sections{}
.options{}
.main_ad{}
.side_section{}
.side_ad{}
#footer{} 5、源代码下载 |