网站整体布局分析设计
<div></div> 作用:划分页面的区域,布局
中间主体div main 最外层div box
知识点:
div标签:
常用的有id和class属性:<div id=“menu”></div>
<div id="box">
<div id="banner"></div> <!-- 头部:横幅的图片区域 banner -->
<div id="menu“></div> <!-- 头部:导航栏区域 menu -->
<div id="main"> <!-- 中间主要的部分 main -->
<div id="left"> </div>
<div id="right"></div>
</div>
<div id="footer"></div> <!-- 最下面尾部的区域:footer -->
</div>
Css样式:
@charset "utf-8";
#box{
width:1024px;/* 设置id是box的div,高度为1014px */
height:1300px;
margin:0 auto;/*居中*/
background-color:#C00;
}
<!– 图片区域的高、宽、背景色 -->
#banner{
width:100%;
height:209px;
background-color:#6FF;
}
<!– 导航菜单区域的高、宽、背景色 -->
#menu{
height:50px;
background-color:#328048;
}
<!– 中间一大块主体区域的高、宽、背景色 -->
#main{
height:1000px;
padding-top:10px;
}
<!– 中间区域左边部分的的高、宽、背景色 -->
#left{
height:1000px;
width:250px;
background-color:#6F9;
float:left;
}
#right{
height:1000px;
width:744px;
background-color:#FFC;
float:right;
}
#footer{
height:80px;
background-color:#328048;
}
导航与Banner的实现
#banner:一张头部图片
#menu:导航菜单
知识点:
图片标签<img>:
<!DOCTYPE HTML>
<html>
<head>
<meta http-equiv="Content-Type" content="text/html; charset=utf-8">
<title>无标题文档</title>
<!--引入css文件用link标签-->
<link href="blog.css" type="text/css" rel="stylesheet"/>
</head>
<body>
<div id="box">
<div id="banner">
<img src="images/bg.jpg" alt="我的图片不见了/">
</div>
<div id="menu">
我是菜单
</div>
<div id="main">
<!--左边区域-->
<div id="left">
左边区域
</div>
<!--右边区域-->
<div id="right">
右边区域
</div>
</div>
<div id="footer">
foot
</div>
</div>
</body>
</html>
@charset "utf-8";
/*CSS Document*/
#box{
background-color:#F9C;
width:1024px;
height:1300px;
/*margin:0 auto;*/
margin:0 auto 0 auto
}
/*放图片,设置高度和图片一样高*/
#banner{
background-color:#6F6;
height:209px;
}
#menu{
background-color:#3C9;
height:50px;
}
#main{
background-color:#FCF;
height:1000px;
}
#left{
background-color:#C09;
height:1000px;
width:250px;
float:left;
}
#right{
background-color:#0CF;
height:1000px;
width:774px;
float:right;
}
#footer{
background-color:#F6F;
height:80px;
}