利用css布局在图片插入文字

在图片里添加文字)

1、【background】引用背景图片,

两种引用:

css:{background:URL(img.jpg)}

html: <a src="img.jpg"></a>

 

2、建立需要尺寸的div块, 在新建一个div块,,利用原始的覆盖现有的。

3、块需被包含在图片【div】块里,再包含文字【div】块。

4、注需要控制方向【 float】。

<!doctype html>
<html>
<head>
<meta charset="utf-8">
<title>图片添加文字</title>
<style type="text/css">      
.div{width:800px; height:450px;}
.img{width:800px; height:450px; background:url(../img.jpg);}
.imgfont{ width:650px; height:400px; float:right;}
.font{ width:650px; height:50px; float:right;}
.fontt{width:180px;height:50px; text-align:center; color:#FFF; font-size:16px;}
</style>
</head>

<body>
<div class="img">
 <div class="imgfont">
  </div>
   <div class="font">
     <div class="fontt">
      <p>这是一张图片</p>
       </div>
    </div>
</div>
</body>
</html>

 

posted @ 2015-06-22 01:31  黑衣大葛葛  阅读(4120)  评论(0编辑  收藏  举报