CSS background-color背景色属性设置
background-color属性
CSS中,background-color属性,可以用来为HTML的元素设置背景色。其中,背景色可以采用rgb值、或hex值(十六进制值)、或hsl(色相饱和度)类型的值,也可以采用内置的颜色名称,比如blue、skyblue、orange等等,如果值为transparent,则背景颜色为透明,如果是inherit,则从父元素继承。
background-color实例代码,及在线编辑器
<div id='a'></div>
<p id='b'>这是段落p</p><br>
<span id='c'>这是span元素</span>
<style>
#a{width:100%;height:10%;background-color:skyblue;}
#b{background-color:green;}
#c{background-color:rgb(100,250,255);}
</style>