<html>
<head>
<style>
.p{
display:block
width:200px
height:100px
border:1px solid #f00
background:url('图片地址')
}
</head>
<body>
<div class='wenzi'>
<p>我的数据</p>
</div>
</body>
</html>
需要准备的材料分别有:电脑、浏览器、html编辑器。
1、首先,打开html编辑器,新建html文件,例如:index.html。
2、在index.html中的<style>标签中,输入css代码:div{background-color: #0b93d5}。
3、浏览器运行index.html页面,此时成功实现了只在文字的后面又蓝色背景色。
在CSS中指定背景图片中的某一区域为背景是可以实现的。需要用到background-postion属性。如background-position: 50px 100px
方法示例可参考:
http://www.w3school.com.cn/tiy/t.asp?f=csse_background-position_pixel