一般都用CSS样式来设置
background用来设置背景颜色
<h1style="color:red;font-size:20px;background-color:black"></h1>
或者
<style>h1{color:red;font-size:16px;background-color:white;}</style>
扩展:
<h1>-<h6>标签可定义标题。<h1>定义最大的标题。<h6>定义最小的标题。
由于h元素拥有确切的语义,因此请您慎重地选择恰当的标签层级来构建文档的结构。因此,请不要利用标题标签来改变同一行中的字体大小。相反,我们应当使用层叠样式表定义来达到漂亮的显示效果。
background简写属性在一个声明中设置所有的背景属性。
可以设置如下属性:
background-color
background-position
background-size
background-repeat
background-origin
background-clip
background-attachment
background-image
如果不设置其中的某个值,也不会出问题,比如background:#ff0000url('smiley.gif');也是允许的。
通常建议使用这个属性,而不是分别使用单个属性,因为这个属性在较老的浏览器中能够得到更好的支持,而且需要键入的字母也更少。