1.讓三個(gè)DIV并排顯示(三種方法實(shí)現(xiàn))
第一種方法:inline-block
<!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>方法1</title>
<style>
div{
width:100px;
height:100px;
color:black;
background-color:red;
display:inline-block;
}
</style>
</head>
<body>
<div class="box">DIV</div>
<div class="box">DIV</div>
<div class="box">DIV</div>
</body>
</html>
第二種方法:浮動(dòng)
<!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>方法2</title>
<style>
div{
width:100px;
height:100px;
background-color:red;
color:black;
float:left;
margin:5px;
}
</style>
</head>
<body>
<div class="box1">DIV</div>
<div class="box2">DIV</div>
<div class="box3">DIV</div>
</body>
</html>
2.png
第三種方法:定位
<!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>方法3</title>
<style>
div{
width:100px;
height:100px;
background-color:red;
color:black;
}
.box2{
position:relative;
left:110px;
bottom:100px;
}
.box3{
position:relative;
left:220px;
bottom:200px;
}
</style>
</head>
<body>
<div class="box1">DIV1</div>
<div class="box2">DIV2</div>
<div class="box3">DIV3</div>
</body>
</html>
3.png
2.騰訊大學(xué)—列表頁(yè)
<!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>作業(yè)2</title>
<style>
body div span dl dt dd{
padding:0px;
margin:0px; /*清除默認(rèn)樣式*/
}
.list{
padding:0px 20px;
width:226px; /*設(shè)置整體的寬度,高度有整體內(nèi)容撐開*/
}
.tittle{
background:url(icon-rank.png) no-repeat left bottom;
padding:20px 0px 0px 30px;
}
#box{
margin:0px;
padding:0px;
width:226px;
height:34px;
background:url(rank-tab-gray-bg.png) no-repeat left bottom;
}
a{
text-decoration:none;
color:#000;
}
.tittle1{
margin:0px;
margin-left:2px;
padding:10px 27px;
border:1px solid #cccccc;
border-bottom:none;
border-right:none;
font-size:14px;
line-height:24px;
}
.tittle2{
margin:0px;
margin-right:2px;
padding:10px 27px;
border:1px solid #cccccc;
border-top:none;
border-right:none;
font-size:14px;
line-height:24px;
}
.lb1{
margin-top:15px;
height:160px;
width:226px;
background:url(1452663224623.jpg) no-repeat;
}
.lb2{
margin-top:20px;
height:160px;
width:226px;
background:url(1466672022953.jpg) no-repeat;
}
.lb3{
margin-top:20px;
height:160px;
width:226px;
background:url(1416453832912.png) no-repeat;
}
.lb4{
margin-top:20px;
height:160px;
width:226px;
background:url(1445345193444.jpg) no-repeat;
}
.lb5{
margin-top:20px;
height:160px;
width:226px;
background:url(1403269947115.png) no-repeat;
} /*圖片的5大板塊*/
.xbt1{
width:8px;
height:26px;
font:bold 9px/24px '微軟雅黑';
color:#FFF;
padding:0px 6px;
background:#e2291c;
display:inline-block;
position:relative;
top:125px;
}
.xbt2{
width:8px;
height:26px;
font:bold 9px/24px '微軟雅黑';
color:#FFF;
padding:0px 6px;
background:#ec5a2e;
display:inline-block;
position:relative;
top:125px;
}
.xbt3{
width:8px;
height:26px;
font:bold 9px/24px '微軟雅黑';
color:#FFF;
padding:0px 6px;
background:#f6a544;
display:inline-block;
position:relative;
top:125px;
}
.xbt4{
width:8px;
height:26px;
font:bold 9px/24px '微軟雅黑';
color:#FFF;
padding:0px 6px;
background:#ec5a2e;
display:inline-block;
position:relative;
top:125px;
}
.xbt5{
width:8px;
height:26px;
font:bold 9px/24px '微軟雅黑';
color:#FFF;
padding:0px 6px;
background:#f6a544;
display:inline-block;
position:relative;
top:125px;
} /*5個(gè)小序號(hào)的樣式*/
.nr2{
width:196px;
height:26px;
padding-left:10px;
background:#0b1213;
display:inline-block;
position:relative;
top:134px;
opacity:0.5;
} /*小透明度的設(shè)置*/
.nr3{
width:196px;
height:26px;
font:bold 12px/26px '微軟雅黑';
color:#FFF;
display:inline-block;
position:relative;
left:30px;
top:99px; /*字體的設(shè)置,為了防止字體也有透明度,所以在此處加上這個(gè)*/
}
dt{
height:20px;
padding-left:6px;
background:url(icon-rank-item.png) no-repeat;
word-spacing:16px;
font:12px/20px '微軟黑體';
color:#000000;
overflow:hidden;
}
dd{
height:10px;
} /*為了設(shè)置列表中的空位*/
</style>
</head>
<body>
<div class="list">
<h2 class="tittle">排行榜</h2>
<div id="box">
<span class="tittle1"><a href="#">最熱排行</a></span><span class="tittle2"><a href="#">最新上線</a></span>
</div>
<a href="#"><div class="lb1">
<span class="xbt1">1</span><span class="nr2"></span><span class="nr3">張小龍:微信四大價(jià)值觀</span>
</div></a>
<a href="#"><div class="lb2">
<span class="xbt2">2</span><span class="nr2"></span><span class="nr3">劉超:互聯(lián)網(wǎng)時(shí)代需要什么樣的UX設(shè)計(jì)人才?</span>
</div></a>
<a href="#"><div class="lb3">
<span class="xbt3">3</span><span class="nr2"></span><span class="nr3">馬化騰:騰訊將專注于互聯(lián)網(wǎng)的連接器</span>
</div></a>
<a href="#">
<div class="lb4">
<span class="xbt4">4</span><span class="nr2"></span><span class="nr3">IT領(lǐng)袖會(huì)圓桌會(huì)議:互聯(lián)網(wǎng)下一個(gè)風(fēng)口在哪兒</span>
</div></a>
<a href="#"><div class="lb5">
<span class="xbt5">5</span><span class="nr2"></span><span class="nr3">微信支付對(duì)實(shí)體商業(yè)的價(jià)值幾何?</span>
</div></a>
<a href="#"><dl>
<dt>6 張小龍:小程序正式發(fā)布,開啟移送應(yīng)用新時(shí)代</dt>
<dd></dd>
<dt>7 馬化騰:通向互聯(lián)網(wǎng)未來的七個(gè)路標(biāo)</dt>
<dd></dd>
<dt>8 馬化騰:騰訊現(xiàn)在只做兩件事</dt>
<dd></dd>
<dt>9 使用UE4制作VR內(nèi)容的優(yōu)化</dt>
<dd></dd>
<dt>10 何凌南:謠言在想什么?</dt>
<dd></dd>
</dl></a>
</div>
</body>
</html>
123.png
1234.png
百度鏈接:http://pan.baidu.com/s/1kVLmrmn 密碼:d8f9