1.常用的方式是:将一张图片设置为背景,然后在里面加文字,代码如下:
<div style="background:url('img.jpg') no-repeat;width:20px;height:50px">添加文字</div>
2.设置图片与文字的相对位置,添加文字,代码如下:
<div class="s1" id="s1">
<img src="路径" style="position: relative;width:400px; height:250px;">
<span style="position: absolute; top: 65px; left: 150px;color:yellow;">文字</span>
</div>
其中position: 属性是关键,relative(