第三次編程

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

最后編輯于
?著作權(quán)歸作者所有,轉(zhuǎn)載或內(nèi)容合作請(qǐng)聯(lián)系作者
平臺(tái)聲明:文章內(nèi)容(如有圖片或視頻亦包括在內(nèi))由作者上傳并發(fā)布,文章內(nèi)容僅代表作者本人觀點(diǎn),簡(jiǎn)書系信息發(fā)布平臺(tái),僅提供信息存儲(chǔ)服務(wù)。

推薦閱讀更多精彩內(nèi)容

  • 這次的編程真的是陸陸續(xù)續(xù)的搞了好久今天終于一口氣都給補(bǔ)完了 心累..第二個(gè)編程 做的有點(diǎn)糙...我真的是盡力了最后...
    9妹9妹閱讀 191評(píng)論 1 1
  • 這是一些學(xué)習(xí)資源,里面有Android的,iOS的,PHP的,大數(shù)據(jù)的,Java的,web前端的,C++,Pyth...
    草蜢的逆襲閱讀 5,304評(píng)論 1 50
  • 還有四天課程結(jié)束了,說實(shí)話堅(jiān)持到現(xiàn)在,覺得有些吃力,時(shí)間太緊張,最近忙的半夜寫作業(yè),但是我堅(jiān)信我一定能堅(jiān)持到最后,不放棄
    楠楠929閱讀 275評(píng)論 0 5
  • 屬于我的2.0時(shí)代來了。 距離2015年7月1日,已經(jīng)過去整整兩年多了。而現(xiàn)在的這份工作,和大多數(shù)人一樣,已經(jīng)是我...
    34號(hào)先生閱讀 195評(píng)論 0 0
  • 1、勇敢得邁出第一步,后面的一切無論如何,都不會(huì)遺憾了。 2、德州撲克:你不能總想著靠運(yùn)氣去贏,因?yàn)樯系勖媲埃巳?..
    許小敬閱讀 303評(píng)論 0 0