CSS樣式表——佈局練習(製作360網頁)

weixin_33831673發表於2015-12-25

以製作360網頁為例(只做到了靜態網頁)

提綱:1.總共分為7部分

 

 

懸浮窗:

 

 

 

原始碼:

 


<!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=utf-8" />
<title>無標題文件</title>
<link href="360網頁css第二遍.css" rel="stylesheet" type="text/css" />
</head>


<body>
<div id="搜尋欄">
<div id="綜合搜尋"><img src="360小圖示/好搜logo.png"/></div>
<div><input type="text" id="文字框"></div>
<div><input type="button" value="好搜一下" id="按鈕" class="font1" /></div>



</div>



<div id="左上"><table height="300px" width="230px" cellpadding="4">
<tr>
<td><a href="http://www.people.com.cn">&nbsp;&nbsp;新聞</font></a><span>•</span><a href="http://www.xinhuanet.com">視訊</a></td>
<td><a href="http://www.people.com.cn">電影</a><span>•</span><a href="http://www.xinhuanet.com">電視劇</a></td>
</tr>
<tr >
<td><a href="http://www.people.com.cn">&nbsp;&nbsp;購物</a><span>•</span><a href="http://www.xinhuanet.com">團購</a></td>
<td><a href="http://www.people.com.cn">彩票</a><span>•</span><a href="http://www.xinhuanet.com">理財</a></td>
</tr>
<tr >
<td><a href="http://www.people.com.cn">&nbsp;&nbsp;活期</a><span>•</span><a href="http://www.xinhuanet.com">基金</a></td>
<td><a href="http://www.people.com.cn">小說</a><span>•</span><a href="http://www.xinhuanet.com">海淘</a></td>
</tr>
<tr>
<td><a href="http://www.people.com.cn">&nbsp;&nbsp;遊戲</a><span>•</span><a href="http://www.xinhuanet.com">小遊戲</a></td>
<td><a href="http://www.people.com.cn">動漫</a><span>•</span><a href="http://www.xinhuanet.com">直播秀</a></td>
</tr>
<tr >
<td><a href="http://www.people.com.cn">&nbsp;&nbsp;搞笑</a><span>•</span><a href="http://www.xinhuanet.com">解夢</a></td>
<td><a href="http://www.people.com.cn">教育</a><span>•</span><a href="http://www.xinhuanet.com">度假</a></td>
</tr>
<tr >
<td><a href="http://www.people.com.cn">&nbsp;&nbsp;查詢</a><span>•</span><a href="http://www.xinhuanet.com">星座</a></td>
<td><a href="http://www.people.com.cn">機票</a><span>•</span><a href="http://www.xinhuanet.com">火車票</a></td>
</tr>
<tr >
<td><a href="http://www.people.com.cn">&nbsp;&nbsp;手機</a><span>•</span><a href="http://www.xinhuanet.com">娛樂</a></td>
<td><a href="http://www.people.com.cn">商城</a><span>•</span><a href="http://www.xinhuanet.com">好藥</a></td>
</tr>
</table>
</div>


 


 


<div id="左中">
<table height="120px" width="230px" cellpadding="0">
<tr><td><img src="360小圖示/左中廣告.png" height="60px" width="230px"/></td></tr>
<tr><td>子韜楊冪遊戲秀恩愛單身狗哭了</td></tr>
<tr><td>裝備靠打,玩就知道</td></tr>
</table>
</div>


<div id="左下">
<div id="左下分1">
<table height="30px" width="230px">
<tr><td align="left">猜你愛看</td><td align="right">換一下</td></tr>
</table>
</div>
<div id="左下分2">
<table height="30px" width="230px">
<tr align="center">
<td>頭條</td><td>八卦</td><td>正能量</td><td>軍事</td>
</tr>
</table>
</div>
<div id="左下圖片"><img src="360小圖示/左下廣告.png" /></div>
<div id="左下分3">
<table height="30px"; width="230px">
<tr><td>工信部稱完成提速降費年度目標</td></tr>
</table>
</div>
<div id="左下分4">
<table height="30px"; width="230px">
<tr><td>現金紅包免費送 亞洲新樓王</td></tr></table>
</div>
</div>



<div id="右上">
<table height="360px" width="760px" cellpadding="10">
<tr align="center">

<td><a href="http://www.people.com.cn">好搜</a><span>•</span><a href="http://www.xinhuanet.com">360商城</a></td>
<td><a href="http://www.people.com.cn">新浪</a><span>•</span><a href="http://www.xinhuanet.com">微博</a></td>
<td><a href="http://www.people.com.cn">天貓</a><span>•</span><a href="http://www.xinhuanet.com">聖誕狂歡</a></td>
<td><a href="http://www.people.com.cn">搜狐</a><span>•</span><a href="http://www.xinhuanet.com">視訊</a></td>
<td><a href="http://www.people.com.cn">網易</a><span>•</span><a href="http://www.xinhuanet.com">郵箱</a></td>
<td><a href="http://www.people.com.cn">鳳凰</a><span>•</span><a href="http://www.xinhuanet.com">軍事</a></td>
</tr>
<tr align="center">
<td><a href="http://www.people.com.cn">360遊戲</a></td>
<td><a href="http://www.people.com.cn">淘寶網</a></td>
<td><a href="http://www.people.com.cn">購物</a><span>•</span><a href="http://www.xinhuanet.com">團購</a></td>
<td><a href="http://www.people.com.cn">百度</a><span>•</span><a href="http://www.xinhuanet.com">熱搜</a></td>
<td><a href="http://www.people.com.cn">360</a><span>•</span><a href="http://www.xinhuanet.com">手機衛士</a></td>
<td><a href="http://www.people.com.cn">攜程旅遊</a></td>

</tr>
<tr align="center">

<td><a href="http://www.people.com.cn">愛淘寶</td>
<td><a href="http://www.people.com.cn">360影視</a></td>
<td><a href="http://www.people.com.cn">聚划算</td>
<td><a href="http://www.people.com.cn">國美線上</a></td>
<td><a href="http://www.people.com.cn">東財</a><span>•</span><a href="http://www.xinhuanet.com">理財</a></td>
<td><a href="http://www.people.com.cn">央視網</a><span>•</span><a href="http://www.xinhuanet.com">直播</a></td>
</tr>
<tr align="center">

<td><a href="http://www.people.com.cn">人民</a><span>•</span><a href="http://www.xinhuanet.com">新華</a></td>
<td><a href="http://www.people.com.cn">人民</a><span>•</span><a href="http://www.xinhuanet.com">新華</a></td>
<td><a href="http://www.people.com.cn">人民</a><span>•</span><a href="http://www.xinhuanet.com">新華</a></td>
<td><a href="http://www.people.com.cn">人民</a><span>•</span><a href="http://www.xinhuanet.com">新華</a></td>
<td><a href="http://www.people.com.cn">人民</a><span>•</span><a href="http://www.xinhuanet.com">新華</a></td>
<td><a href="http://www.people.com.cn">人民</a><span>•</span><a href="http://www.xinhuanet.com">新華</a></td>
</tr>
<tr align="center">
<td><a href="http://www.autohome.com.cn">汽車之家</a></td>
<td><a href="http://zibo.bitauto.com">易 車 網</a></td>
<td><a href="http://www.pcauto.com.cn">太平洋汽車</a></td>
<td><a href="http://www.anjuke.com">安 居 客</a></td>
<td><a href="http://out.zhe800.com">折800</a></td>
<td><a href="http://www.suning.com"><font color="#00CC33">蘇寧易購</a></td>
</tr>
<tr align="center">
<td><a href="http://www.12306.cn">12306官網</a></td>
<td><a href="http://www.people.com.cn">人民</a><span>•</span><a href="http://www.xinhuanet.com">新華</a></td>
<td><a href="http://www.ganji.com">趕 集 網</a></td>
<td><a href="http://union.dangdang.com">當 當 網</a></td>
<td><img src="360小圖示/途牛.jpg" width="15" /><a href="http://www.tuniu.com">途牛旅遊網</a></td>
<td><a href="http://www.baidu.com"><font color="#00CC33"><i><b>1號店</b></i></a>&nbsp;<a href="http://www.baidu.com"><img src="360小圖示/搶福袋.jpg" width="40"/></a></td>
</tr>
<tr align="center">
<td><a href="http://www.zhenai.com">真愛婚戀網</a></td>
<td><a href="http://www.moonbasa.com">夢 芭 莎</a></td>
<td><a href="http://www.baidu.com">亞 馬 遜</a></td>
<td><a href="http://www.baidu.com">藝 龍 網</a></td>
<td><a href="http://www.baidu.com">去哪兒網</a></td>
<td><a href="http://www.baidu.com">美 麗 說</a></td>
</tr>
<tr align="center" >
<td><a href="http://www.baidu.com">美 團 網</a></td>
<td><a href="http://www.baidu.com">樂視視訊</a></td>
<td><img src="360小圖示/唯品會.jpg" width="15"/><a href="http://www.baidu.com">唯 品 會</a></td>
<td><a href="http://www.baidu.com"><font color="#CC6600">聚美優品</a></td>
<td><a href="http://www.baidu.com">搜 房 網</a></td>
<td><a href="http://www.baidu.com">蘑 菇 街</a></td>
</tr>
<tr align="center">
<td><a href="http://www.baidu.com">獵 聘 網</a></td>
<td><a href="http://www.baidu.com">1 藥 網</a></td>
<td><a href="http://www.baidu.com">陸金所理財</a></td>
<td><a href="http://www.baidu.com">六 間 房</a></td>
<td><a href="http://www.baidu.com">攜程機票</a></td>
<td><a href="http://www.baidu.com">12306·搶票</a></td>
</tr>
</table>


</div>
<div id="右下">
<div id="右下1"></div>
<table>
<tr><td align="left">猜你喜歡</td></tr>
</table>
<div id="右下2">
<table height="240px" width="760px" cellpadding="2">
<tr align="center"><td>遊戲</td><td>永久免費遊戲</td><td>全部裝備靠打</td><td>非人民幣玩家</td><td>傳奇公益服</td><td>2015新版傳奇</td><td>傳奇單機版</td></tr>
<tr align="center"><td>財經</td><td>金錢</td><td>信用卡</td><td>軟體</td><td>p2p</td><td>理財</td><td>賺錢</td></tr>
<tr align="center"><td>汽車</td><td>買車</td><td>低價</td><td>品牌</td><td>舒適</td><td>二手車</td><td>違章</td></tr>
<tr align="center"><td>生活</td><td>理財</td><td>信用卡</td><td>低價</td><td>信貸</td><td>物流</td><td>賺錢</td></tr>
<tr align="center"><td>購物</td><td>食品</td><td>酒水</td><td>遞減</td><td>清倉</td><td>蘇寧</td><td>京東</td></tr>
<tr align="center"><td>旅遊</td><td>途牛</td><td>去哪</td><td>攜程</td><td>驢媽媽</td><td>機票</td><td>火車</td></tr>
</table>
</div>


</div>
<div id="懸浮窗">這是一個廣告</div>
</body>
</html>

 

CSS表


@charset "utf-8";
/* CSS Document */
<style type="text/css">
*
{
margin:0px;
padding:0px;
}
body{
background-image:url(360小圖示/白灰漸變.png)
}
#搜尋欄
{
border:1px solid #999;
height:60px;
width:1000px;
position:absolute;
}
#綜合搜尋
{
width:100;
height:60px;
left:200px;
top:10px;
position:absolute;
}


#文字框/*難點一:修改文字框高和寬*/
{
width:400px;
height:40px;
top:8px;
left:320px;
position:absolute;
}
#按鈕/*難點二:修改按鈕高和寬,也可以直接在style裡面改*/
{
width:100px;
height:40px;
top:10px;
left:730px;
position:absolute;}
.font1/*難點三:修改按鈕裡面的字型——用class引用*/
{
font-family:"宋體";
font-size:15px;}

#左上
{
background-color:#FFF;
border:1px solid #999;
height:300px;
width:230px;
left:10px;
top:80px;
position:absolute;
}
#左中
{
background-color:#FFF;
border:1px solid #999;
height:120px;
width:230px;
left:10px;
top:390px;
position:absolute;
}



#左下
{
background-color:#FFF;
border:1px solid #999;
height:240px;
width:230px;
left:10px;
top:520px;
position:absolute;
}
#左下分1
{
height:30px;
width:230px;
left:0px;
position:absolute;

}
#左下分2
{
height:30px;
width:230px;
left:0px;
top:30px;
position:absolute;

}
#左下圖片
{
height:120px;
width:230px;
top:60px;
left:10px;
position:absolute;
}
#左下分3
{
height:30px;
width:230px;
left:0px;
top:180px;
position:absolute;

}
#左下分4
{
height:30px;
width:230px;
left:0px;
top:210px;
position:absolute;

}
#右上
{
background-color:#FFF;
border:1px solid #999;
height:360px;
width:760px;
left:250px;
top:80px;
position:absolute;
}
#右下
{
background-color:#FFF;
border:1px solid #999;
height:280px;
width:760px;
left:250px;
top:450px;
position:absolute;
}
#右下1
{
height:40px;
width:760px;
left:250px;
top:0px;
position:absolute;}
#右下2
{
height:240px;
width:760px;
left:0px;
top:40px;
position:absolute;}
#懸浮窗
{
border:5px solid #999;
width:150px;
height:80px;
margin:10px;
background-color:#666;
right:30px;
bottom:20px;
position:fixed;
}
a:link
{
color:#000;
text-decoration:none;}/*下劃線*/
a:visited
{
color:#000;
text-decoration:none}
a:hover
{
color:#F00;
text-decoration:underline;}
a:active
{
color:#F60;
text-decoration:underline;}

</style>

 

總結

 

相關文章