CSS布局小練習

來源:互聯網
上載者:User

不多說了,直接貼代碼。

html檔案

<!DOCTYPE HTML PUBLIC "-//W3C//DTD HTML 4.01 Transitional//EN" "http://www.w3.org/TR/html4/loose.dtd">
<html>
<head>
<link rel="stylesheet" type="text/css" href="boxlx.css">
</head>
<html>
<div class="div1">
<div class="div2">
<span class="s1">優酷牛人</span>
<span class="s2"><a href="#">更多牛人</a></span>
<ul class="faceul">
<li><img src="tt.png"><span>Mariyd</span></li>
<li><img src="tt2.png"><span>道途聽說</span></li>
<li><img src="tt1.png"><span>春秋花月夜</span></li>
</ul>

<span class="s1">明星空間</span>
<span class="s2"><a href="#">更多空間</a></span>
<ul class="faceul">
<li><img src="tt1.png"><span>你喜歡</span></li>
<li><img src="tt.png"><span>道途聽說</span></li>
<li><img src="tt2.png"><span>[90空間]</span></li>
</ul>

<span class="s1">優酷公益</span>
<span class="s2"><a href="#">更多公益官網</a></span>
<ul class="faceul">
<li><img src="tt2.png"><span>公益基金會</span></li>
<li><img src="tt1.png"><span>Test公益事業網</span></li>
<li><img src="tt.png"><span>公益事業</span></li>
</ul>
</div>
<div class="div3"></div>
<div class="div4"></div>
</div>
<html>
</html>

css檔案

.div1{
border:1px solid gray;
width:350px;
height:350px;
}

.div2{
/*order:1px solid pink;*/
height:110px;
margin:4px 5px 0px 5px;

}

.div3{
/*order:1px solid pink;*/
height:110px;
margin:4px 5px 0px 5px;
}

.div4{
/*order:1px solid pink;*/
height:110px;
margin:4px 5px 0px 5px;
}
.faceul{
/*order:1px solid pink;*/
height:90px;
width:320px;
margin-top:-5px;
list-style-type:none;
padding-left:0px;
}
.faceul li{
border:1px solid green;
font-size:14px;
height:50px;
width:50px;
float:left;
margin:10px 26px 0px 28px;

}

.faceul img{
height:50px;
width:50px;
}

.faceul li span{
font-size:12px;
margin-top:5px;
display:block; /*關鍵把這裡裝變為區塊層級元素*/
/*下面才能把多出來的字型用省略符號顯示*/
white-space:nowrap;
word-break:keep-all;
overflow:hidden;
text-overflow:ellipsis;
}

.s1{
font-size:16px;
font-weight:bold;
margin:0px 0px 0px 5px;

}
.div2 .s2{
font-size:12px;
float:right;

}
.div2 .s2 a:link{
color:blue;
text-decoration:none;
}

大家有什麼不同意見,可以多多討論,謝謝指導。

相關文章

A Free Trial That Lets You Build Big!

Start building with 50+ products and up to 12 months usage for Elastic Compute Service

  • Sales Support

    1 on 1 presale consultation

  • After-Sales Support

    24/7 Technical Support 6 Free Tickets per Quarter Faster Response

  • Alibaba Cloud offers highly flexible support services tailored to meet your exact needs.