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=utf-8" />
<title>無標題文檔</title>
</head>

<body>
<div style="width:950px; height:600px; color:#999999; margin:0px; padding:0px;float:left;">
<div style="width:950px;height:100px;">
<IMG alt="" src="http://img04.taobaocdn.com/imgextra/i4/664800495/T2JSDNXjxXXXXXXXXX_!!664800495.jpg" ></div>
<div style="margin-left:0px; float:left;">
    <div style="margin-left:0px; width:323; height:153; border:0px;float:left;">
    <IMG alt="" src="http://img03.taobaocdn.com/imgextra/i3/664800495/T2_yeyXfhcXXXXXXXX_!!664800495.jpg" /></div>
    <div style="margin-left:0px; width:323; height:153; border:0px;float:left;">
    <IMG alt="" src="http://img01.taobaocdn.com/imgextra/i1/664800495/T2V4KRXgBbXXXXXXXX_!!664800495.jpg" /></div>
    <div style="margin-left:0px; width:323; height:153; border:0px;float:left;">
    <IMG alt="" src="http://img04.taobaocdn.com/imgextra/i4/664800495/T2rfyyXd8cXXXXXXXX_!!664800495.jpg" /></div>
    <div style="margin-left:0px; width:323; height:153; border:0px;float:left;">
    <IMG alt="" src="http://img01.taobaocdn.com/imgextra/i1/664800495/T2DjXEXllNXXXXXXXX_!!664800495.jpg" /></div>
    <div style="margin-left:0px; width:323; height:153; border:0px;float:left;">
    <IMG alt="" src="http://img01.taobaocdn.com/imgextra/i1/664800495/T2oM2pXotaXXXXXXXX_!!664800495.jpg" /></div>
</div>
<div style="margin-left:0px; float:left;">
    <div style="margin-left:0px; width:291; height:142; border:0px;float:left;">
    <IMG alt="" src="http://img03.taobaocdn.com/imgextra/i3/664800495/T2LAOIXcpcXXXXXXXX_!!664800495.jpg" /></div>
    <div style="margin-left:0px; width:254; height:142; border:0px;float:left;">
    <IMG alt="" src="http://img03.taobaocdn.com/imgextra/i3/664800495/T22cScXlRcXXXXXXXX_!!664800495.jpg" /></div>
    <div style="margin-left:0px; width:133; height:142; border:0px;float:left;">
   <IMG alt="" src="http://img01.taobaocdn.com/imgextra/i1/664800495/T2V7rNXlFXXXXXXXXX_!!664800495.jpg" /></div>
    <div style="margin-left:0px; width:272; height:142; border:0px;float:left;">
    <IMG alt="" src="http://img03.taobaocdn.com/imgextra/i3/664800495/T2uZ6NXdBaXXXXXXXX_!!664800495.jpg" /></div>
</div>
<div style="margin-left:0px; float:left;">
	 <div style="margin-left:0px; width:192; height:202; border:0px;float:left;">
     <div style="margin-left:0px; margin-top:0px ">
     <IMG alt="" src="http://img02.taobaocdn.com/imgextra/i2/664800495/T2WPzpXelaXXXXXXXX_!!664800495.jpg" />
     </div>
     <div style="margin-left:0px; margin-top:0px">
    <IMG alt="" src="http://img04.taobaocdn.com/imgextra/i4/664800495/T2tgrXXdXbXXXXXXXX_!!664800495.jpg" />
     </div>
     </div>
    <div style="margin-left:0px; width:301; height:202; border:0px;float:left;">
    <IMG alt="" src="http://img03.taobaocdn.com/imgextra/i3/664800495/T204TNXnxXXXXXXXXX_!!664800495.jpg" width=301 height=202/></div>
    <div style="margin-left:0px; width:144; height:202; border:0px;float:left;">
    <IMG alt="" src="http://img03.taobaocdn.com/imgextra/i3/664800495/T2abYNXgNaXXXXXXXX_!!664800495.jpg" width=144 height=202/></div>
    <div style="margin-left:0px; width:83; height:202; border:0px;float:left;">
   <IMG alt="" src="http://img04.taobaocdn.com/imgextra/i4/664800495/T2_HSQXdpbXXXXXXXX_!!664800495.jpg" width=83 height=202/></div>
    <div style="margin-left:0px; width:228; height:202; border:0px;float:left;">
    <IMG alt="" src="http://img01.taobaocdn.com/imgextra/i1/664800495/T2FK_pXmBaXXXXXXXX_!!664800495.jpg" width=228 height=202/></div>
</div>
</div>
</body>


</html>


       之前我將這些圖片是用<img/><img/>的格式排列的,發現這個元素之間總是存在3個像素左右的間隔,及時使用了margin-left:0; 也不能改變這種狀態。後來在<img/>兩側都加了,<div></div>元素之後這種情況解決了。  總結:可使用<div></div>做無縫排列。

 

       下面是效果圖:

發佈了32 篇原創文章 · 獲贊 67 · 訪問量 9萬+
發表評論
所有評論
還沒有人評論,想成為第一個評論的人麼? 請在上方評論欄輸入並且點擊發布.
相關文章