利用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{800px; height:450px;}
.img{800px; height:450px; background:url(../img.jpg);}
.imgfont{ 650px; height:400px; float:right;}
.font{ 650px; height:50px; float:right;}
.fontt{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>
原文地址:https://www.cnblogs.com/boyblog/p/4592778.html