利用CSS進行常見的網頁佈局(入門篇)

第一種CSS佈局:三行一列式 

<!DOCTYPE html>
<html>
<head>
	<title>CSS三行一列布局</title>
	<style type="text/css">
     *{
     	margin: 0;
     	padding: 0;
     }
     #container{
     	margin: 0 auto;
     	width: 1000px;
     	height: 600px;
     	/*background-color: #fc9;*/
     }
     #header{
     	height: 100px;
     	background-color: #fc9;
     	margin-bottom: 5px;
     }
	 #main{
	 	height: 500px;
	 	background-color: #cf9;
	 	margin-bottom: 5px;
	 }
	 #botton{
        height: 60px;
        background-color: #ccc;
	 }
	</style>
</head>
<body>
<div id="container">
	<div id="header"></div>
	<div id="main"></div>
	<div id="botton"></div>
</div>
</body>
</html>

三行一列式網頁佈局:

佈局樣式效果圖:

第二種CSS佈局:三行兩列布局:

<!DOCTYPE html>
<html>
<head>
	<title>css三行兩列布局</title>
	<style type="text/css">
     *{margin: 0;
       padding: 0;
     }
     #container{
     	margin: 0 auto;
     	width: 1000px;
     	height: 600px;	
     }
     #header{
        height: 100px;
        background-color: #fc9;
        margin-bottom: 5px;
     }
     #main{
     	width: 1000px;
     	height: 500px;
     	margin-bottom: 5px;
     }
     #aside{
     	float: left;
     	width: 300px;
     	height: 500px;
     	background-color: #fc9;
     }
     #content{
     	float: right;
     	width: 695px;
     	height: 500px;
     	background-color: #ccc;
     }
     #botton{
     	height: 90px;
     	background-color: #ccc;
     }
	</style>
</head>
<body>
    <div id="container">
    	<div id="header"></div>
    	<div id="main">
    		<div id="aside"></div>
    		<div id="content"></div>
    	</div>
    	<div id="botton"></div>
    </div>
</body>
</html>

三行兩列布局

佈局圖效果圖如下:

 

發表評論
所有評論
還沒有人評論,想成為第一個評論的人麼? 請在上方評論欄輸入並且點擊發布.
相關文章