学习内容
font字体 font-family:字体;
font-size:字体大小
font-color:字体颜色
font-style:字体风格
font-weight:字体粗细
text文本 text-align:设置水平方向上的居中
text-indent:首行缩进
text-height:行高
text-decoration:文本修饰
即下划线等 padding内边距:会撑开盒子 padding:top right bottom left
margin内边距:不会撑开盒子 margin:top right bottom left
项目实战
演示图: 代码如下:
<!DOCTYPE html>
< html lang = " zh" >
< head>
< meta charset = " UTF-8" />
< meta name = " viewport" content = " width=device-width, initial-scale=1.0" />
< title> 新闻列表</ title>
< style>
* {
padding : 0px;
margin : 0px;
}
.news {
width : 240px;
height : 304px;
margin : 30px auto;
background-image : url(/images/bg.gif) ;
padding : 10px;
border : darkgreen 1px solid;
}
.news h1 {
text-align : left;
border-left : #c9e143 solid 4px;
font-family : "黑体" ;
font-size : 20px;
color : #fff;
padding-left : 5px;
}
.news ul {
background-color : #fff;
margin-top : 5px;
padding : 0px 10px;
}
.news li {
list-style : none;
background : url("images/tb.gif") left no-repeat;
}
.news a {
display : inline-block;
line-height : 30px;
text-decoration : none;
border-bottom : 1px dashed#666;
color : #06c;
font-size : 12px;
text-indent : 1em;
}
.news a:hover {
text-decoration : underline;
color : brown;
}
</ style>
</ head>
< body>
< div class = " news" >
< h1> 爱宠知识</ h1>
< ul>
< li> < a href = " #" > 养狗比养猫对健康更有利</ a> </ li>
< li> < a href = " #" > 日本正宗柴犬亮相,你怎么看柴犬</ a> </ li>
< li> < a href = " #" > 狗狗歌曲《新年旺旺》</ a> </ li>
< li> < a href = " #" > 带宠兜风,开车带宠需要注意什么?</ a> </ li>
< li> < a href = " #" > 【爆笑】这狗狗太不给力了</ a> </ li>
< li> < a href = " #" > 狗狗与男童相同着装拍有爱造型照</ a> </ li>
< li> < a href = " #" > 狗狗各个阶段健康大事件</ a> </ li>
< li> < a href = " #" > 调皮宠物狗陷在沙发里的搞笑瞬间</ a> </ li>
< li> < a href = " #" > 为什么每次大小便后,会用脚踢土?</ a> </ li>
</ ul>
</ div>
</ body>
</ html>
素材图片