⑴ css 把一个文本标签放到图片上方指定位置怎么实现
1.把图片做为背景图,然后用填充或者边距控制文字位置即可
2.如果不能作为背景,则将文本设为绝对定位.根据父标签定位到指定位置.
⑵ png图片浮在文字上方用div+css怎样实现
你应该是要用在文章页吧?对于这种内容不固定的东西建议使用position定位方式:
一共三个块级元素标签,post为整个文章内容区域,content默认可以只加一个最小高度(如min-width:200px),mark就是那个印章了。
主要原理就是父容器post相对定位(position:relative),印章mark绝对定位(position:absolute),然后就可以随意设置mark的top/bottom和left/right属性来进行定位了,z-index一般不用设置,因为根据文档顺序,后出现的内容会挡住前面的内容。
基本的HTML结构:
<div
class="post">
<div
class="content"></div>
<div
class="mark"></div>
</div>
基本的样式:
<style
type="text/css">
.post
{
position:
relative;
}
.content
{
min-width:
200px;
}
.mark
{
position:
absolute;
top:
100px;
right:
50px;
width:
150px;
height:
150px;
background:
url(images/mark.png)
no-repeat
center
center;}
</style>
对于IE6的PNG透明问题的简易解决方法是在.mark类中追加
_background:none;
_filter:progid:DXImageTransform.Microsoft.AlphaImageLoader(src="images/mark.png"
,sizingMethod="crop");
这两句,如果有问题可以继续...
⑶ css怎么在图片上添加文字
先设置一个div并插入图片,设置这个div相对定位。
再第一个div里插入第二个div设置绝对定位,并输入文字即可。
⑷ CSS 文字居于图片上
代码参考如下:
<body>
<divstyle="position:relative;width:100px;height:100px;border:1pxsolid#ccc;text-align:center;">
<imgsrc="../11.jpg"width="100"height="100">
<spanstyle="width:48px;height:12px;line-height:12px;position:absolute;top:50%;left:50%;margin-left:-24px;margin-top:-6px;">xxxxxx</span>
</div>
</body>
主要思想:用定位方式定位水平垂直居中。
⑸ 通过CSS+DIV怎么将文字写在图片上方
HTML图片和文字是并列显示的。如下:
HTML
<div class="img-group"> <img src="img/snow.png">
<div class="img-tip">我是雪豹</div></div>
CSS
.img-group { position: relative; display: inline-block;
}
.img-tip { position: absolute; bottom: 0; background: #333; color: #fff; opacity: 0.6; display: none;
}
.img-group:hover .img-tip { display: block; width: 100%; text-align: center;
}
⑹ html中怎么让文字在图片的上面
1、在div里面书写了一些文字,然后想要在放入一张图片。
⑺ html用css怎样把文字覆盖到图片上
可以把图片作为文字那个块标签的背景图片或者你把图片和文字都放在一个同一个div 里面然后给图片和文字加上定位,然后文字的图层比图片的图层位置高就行了。
第一种
<style>
.div{width: 200px;height: 200px;background: url("图片路径") no-repeat;}
</style>
<div class="div">
<p>你的文字内容</p>
</div>
第二种
<style>
.div{width: 200px;height: 200px;position: relative;z-index: 0}
.div img{position: absolute;top: 0;left: 0;width: 100px;height: 100px;}
.div p{position: absolute;top: 0;left: 0;z-index: 10;}
</style>
<div class="div">
<img src="图片路径" alt="#">
<p>你的文字内容</p>
</div>
⑻ 如何用CSS往图片上嵌入文字
具体操作步骤如下:
一、首先是准备一个HTML文档,接着在HTML中添加一个DIV,并给DIV设置宽高和背景图片。
⑼ css 怎么设置文字在图片上并居中
1、首先,打开html编辑器,新建html文件,例如:index.html。
⑽ css怎么让文字显示在图片的上面
工具/材料:电脑。
css让文字显示在图片上的操作步骤如下:
1、首先在div里面书写文字,然后放入1张图片。