图片上添加文字--<div>

1.常用的方式是:将一张图片设置为背景,然后在里面加文字,你加入的图片代码是:

<img src="img.jpg" width='100px" height="50px">

改为

<div style="background:url('img.jpg') no-repeat;width:100px;height:50px">添加文字</div>

================================================================

2.一种是:加<span>标签,设置css样式,你加入的代码是:

<div style="position: relative; width: 170px; height: 89px;">
<img src="图片地址" width="170" height="89" alt="">
<span style="position: absolute; top: 0; left: 0;">添加文字...添加文字...添加文字...</span>
</div>

posted @ 2014-02-22 14:47  Chihiro  阅读(3632)  评论(0编辑  收藏  举报