码迷,mamicode.com
首页 > Web开发 > 详细

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

时间:2015-06-22 07:34:07      阅读:165      评论:0      收藏:0      [点我收藏+]

标签:

在图片里添加文字)

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>

 

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

标签:

原文地址:http://www.cnblogs.com/boyblog/p/4592778.html

(0)
(0)
   
举报
评论 一句话评论(0
登录后才能评论!
© 2014 mamicode.com 版权所有  联系我们:gaon5@hotmail.com
迷上了代码!