有没有办法使用文本使用与CSS背景的方法吗? [英] Is there a way to use use text as the background with CSS?
本文介绍了有没有办法使用文本使用与CSS背景的方法吗?的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!
问题描述
我想用动态文本作为我的标签某些元素的背景。正因为如此,我可以用图像(动态文本)。我如何只用CSS或JavaScript做呢?
I would like to use dynamic text as background of certain elements in my tag. Because of this, I can use images (dynamic text). How do I do it with just CSS or JavaScript?
推荐答案
您可以有你的相对定位的元素里面绝对定位的元素:
You can have an absolutely positioned element inside of your relative positioned element:
<div id="container">
<div id="background">
Text to have as background
</div>
Normal contents
</div>
和则CSS:
#container {
position: relative;
}
#background {
position: absolute;
top: 0;
left: 0;
bottom: 0;
right: 0;
z-index: -1;
overflow: hidden;
}
下面的它的一个例子。
这篇关于有没有办法使用文本使用与CSS背景的方法吗?的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!
查看全文