怎么在CSS里面更改h1的背景颜色和字体颜色?

html-css012

怎么在CSS里面更改h1的背景颜色和字体颜色?,第1张

它们二者分别使用属性color和background-color来实现的.

设置h1的样式为:

h1{

background-color:#678

color:white;

}

将背景色设置为#678,也就是相当与#667788,并将文字颜色设置为白色。

可以。

参考如下代码:

-------------------------------------------------

你要用一个标签(span,p,div...等等)

然后给标签设置背景颜色background-color即可

-------------------------------------------------

运行效果如图:

<div style="width:800pxheight:600pxbackground:url(https://www.taopic.com/uploads/allimg/130427/240403-13042F61F080.jpg) no-repeat center / cover">背景图

<div style="width:400pxheight:200pxmargin:200px autobackground-color:rgba(0,0,0,0.5)color:#ffftext-align:centerline-height:200px">这是文字这是文字</div>

</div>