下面我们来看一个为文字添加简单的颜色底纹案例:
<html> <body> <h1>无底纹的标题</h1> <strong>无底纹的句子</strong> <p>无底纹的段落</p> <h1 style="background:yellow">底纹为黄色的标题<h1> <strong style="background:red">底纹为红色的句子</strong> <p style="background:green">底纹为绿色的段落</p> </body> </html>
效果图:
background属性:
可以设置的属性分别是:background-color, background-position, background-size, background-repeat, background-origin, background-clip, background-attachment,和background-image.
属性介绍:
background-color 指定要使用的背景颜色
background-position 指定背景图像的位置
background-size 指定背景图片的大小
background-repeat 指定如何重复背景图像
background-origin 指定背景图像的定位区域
background-clip 指定背景图像的绘画区域
background-attachment 设置背景图像是否固定或者随着页面的其余部分滚动。
background-image 指定要使用的一个或多个背景图像
更多web前端相关知识,请查阅 HTML中文网 !!
以上就是HTML文字底纹怎么设置?的详细内容,更多请关注0133技术站其它相关文章!