国产探花免费观看_亚洲丰满少妇自慰呻吟_97日韩有码在线_资源在线日韩欧美_一区二区精品毛片,辰东完美世界有声小说,欢乐颂第一季,yy玄幻小说排行榜完本

首頁 > 開發 > CSS > 正文

DIV+CSS通用樣式布局實例代碼

2024-07-11 08:26:01
字體:
來源:轉載
供稿:網友
一下是一個非常簡單易懂的通用樣式布局,希望對于剛開始接觸DIV+CSS的同學有幫助。先看效果圖:


我們可以看出通常的頁面布局有以下幾個部分:頭部、內容、底部,其中內容有左側主顯區和右側邊欄。下面貼出代碼:

復制代碼
代碼如下:
<!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=gbk" />
<title>DIV+CSS practice</title>
<link href="css/common.css" rel="stylesheet" type="text/css" media="all" />
</head>
<body>
<!-- 頭部 -->
<div id="head">
</div>
<!--END 頭部 -->
<!-- 主容器 -->
<div id="container">
<!-- 左側主顯區 -->
<div id="content">
</div>
<!-- END 左側主顯區 -->
<!-- 右側邊欄 -->
<div id="side">
</div>
<!-- END 右側邊欄 -->
</div>
<!-- END 主容器 -->
<div class="clear"></div>
<!-- 底部 -->
<div id="foot">
</div>
<!-- END 底部 -->
</body>
</html>
common.css樣式文件:
*{
margin:0;
padding:0;
}
body{
background-color:gray;
}
.clear{
clear:both;
}
/*head*/
#head{
background-color:blue;
height:150px;
}
/*container*/
#container{
background-color:red;
width:960px;
height:800px;
margin:20px auto;
}
/*content*/
#content{
background-color:yellow;
float:left;
width:685px;
height:100%;
}
/*side*/
#side{
background-color:green;
float:right;
width:255px;
height:100%;
}
/*foot*/
#foot{
background-color:white;
height:150px;
width:960px;
margin:20px auto;
}

大致布局很簡單了,首先要有這個大局觀,然后再完善其中的細節,學習PHP或者其他語言同樣如此,首先要有一個思想,知道每一步做什么,怎么做,這樣才能把知識靈活運用。

發表評論 共有條評論
用戶名: 密碼:
驗證碼: 匿名發表
主站蜘蛛池模板: 勃利县| 郯城县| 常德市| 汉中市| 时尚| 贡觉县| 都江堰市| 许昌市| 巧家县| 黔东| 池州市| 望城县| 阿巴嘎旗| 罗山县| 河曲县| 滦南县| 冀州市| 安远县| 舒兰市| 奈曼旗| 庆元县| 葵青区| 东台市| 同江市| 桐城市| 永定县| 漳平市| 漠河县| 福海县| 汤阴县| 那曲县| 建平县| 远安县| 腾冲县| 遵义市| 密山市| 若尔盖县| 横山县| 石嘴山市| 龙江县| 庐江县|