请补充和完善CSS代码部分。要求:(1)不能修改html代码。(2)第一部分:字体大小3?

html-css016

请补充和完善CSS代码部分。要求:(1)不能修改html代码。(2)第一部分:字体大小3?,第1张

<style>

body{

text-align:center/*body内所有元素水平居中*/

}

.title{

font-size: 30px

font-weight: bold/*加粗*/

font-family: "SimHei"/*黑体*/

text-decoration: underline/*下划线*/

}

.intro{

text-align: left/*不参与水平居中*/

font-family: "SimSun"/*宋体*/

font-style: italic/*斜体*/

text-indent: 35px/*首行缩进*/

line-height: 200%/*行距*/

}

.poem{

display: inline-block/*为了和图片在同一行*/

font-size: 30px

font-family: "LiSu"/*隶书*/

line-height: 150%/*行距*/

border: 2px dashed #000000

width: 300px

height: 250px

}

.img{

display: inline-block/*为了和诗句在同一行*/

}

</style>

示例参考 提取码: 2i8v:

难道你说的是注释。。。

<!------------说明啦------------>

这句话只是让浏览代码的人看的,不会影响布局页面,放在你要针对说明代码的后面或前面就行啦

CSS文件和页面填写css代码的优先问题,首先我们需要理解的是,在页面填写的CSS的优先级是高于引入文件的优先级的,因为那个css的样式更靠近要影响的元素,我们可以通过代码来理解一下:

html中:

<html>

<head>

<style>

table tr{

width:200px

height:100px

color:blue

}

</style>

<link rel='stylesheet' type='text/css' href='./css/index1.css'>

</head>

<body>

<table>

<tr style="">

<td>我i是测试文字</td>

</tr>

</table>

</body>

</html>

css文件中:

table tr{

width:300px

height:200px

color:red

}

这里写了2个CSS样式,唯一不同的就是文字的颜色,因为css的优先级,在在这里是不会执行外部文件的css样式,而是会去执行更加靠近这个tr的css样式,因而color会执行blue。