1称簿,列表樣式
1-1,列表類型
無序列表項的標志 (marker) 是出現(xiàn)在各列表項旁邊的圓點荒澡。在有序列表中,標志可能是字母与殃、數(shù)字或另外某種計數(shù)體系中的一個符號单山。
要修改列表項的標志類型,使用屬性 list-style-type:
.ul1 { list-style-type: square }/*方塊*/
.ul2 { list-style-type: none }/*沒有*/
運行效果:
1-2幅疼,列表項圖像
對各標志使用一個圖像米奸,利用 list-style-image 屬性:
li {
? list-style-image: url(../img/style-img.png)
}
運行效果:
1-3,列表標識位置
標志出現(xiàn)在列表項內(nèi)容之外還是內(nèi)容內(nèi)部爽篷,利用 list-style-position屬性:
li { border: 2px solid #fa037b }
.ul1 { list-style-position: outside } /*在外面*/
.ul2 { list-style-position: inside } /*在里面*/
運行效果:
2悴晰,表格樣式
1-1,邊框
設置表格邊框逐工,使用 border 屬性
table, th, td {
? border: 2px solid #fa037b
}
運行效果:
如果表格只顯示單線條邊框,可以用 border-collapse 屬性泪喊。
border-collapse 屬性設置是否將表格邊框折疊為單一邊框:
table { border-collapse: collapse }
table, th, td {
?border: 2px solid #fa037b
}
運行效果:
1-2佃却,寬度和高度
通過 width 和 height 屬性定義表格的寬度和高度
table, th, td {
? border: 2px solid #fa037b
}
th {
? width: 100px;
? height: 50px
}
運行效果:
1-3,文本對齊
text-align 和 vertical-align 屬性設置表格中文本的對齊方式
1】text-align 屬性設置水平對齊方式窘俺,如左對齊饲帅、右對齊或者居中
2】vertical-align 屬性設置垂直對齊方式,如頂部對齊瘤泪、底部對齊或居中對齊
td {
? height: 50px;
? vertical-align: bottom;/*垂直對齊*/
? text-align: center /*水平對齊*/
}
運行效果:
1-4灶泵,內(nèi)邊距
表格中設置內(nèi)容與邊框的距離,為 td 和 th 元素設置 padding 屬性
td { padding: 20px }
運行效果:
1-5对途,表格顏色
設置邊框顏色和th 赦邻, td 的背景色
table, th, td {
? ?border: 2px solid #fa037b
}
th {
? background-color: #8A2BE2;
? color: #FFF
}
td {
background-color: #556B2F;
color: #8B0000
}
運行效果: