<分区>
编辑问题以包含 desired behavior, a specific problem or error, and the shortest code necessary to reproduce the problem .这将有助于其他人回答问题。
关闭 8 年前。
<分区>
编辑问题以包含 desired behavior, a specific problem or error, and the shortest code necessary to reproduce the problem .这将有助于其他人回答问题。
关闭 8 年前。
你好,我想知道如何让我的文本背景看起来像我在 my website 的 slider 我使用的是 wordpress 主题,所以只有文本的背景是完美的否则它看起来像 this
<h1 class = "myClass">My Text Here</h1>
我想在css中给它一个透明的黑色背景
.myClass{
font-size:70px;
color: white;
}
我还需要它只在我的文字后面我不希望背景占据页面的整个宽度
解决方案很简单
padding: 4px 0;
font-size: 70px;
color: white;
background-color: rgba(0,0,0, .5);
line-height: 95px;
display: inline;
最佳答案
此外,添加行高
.WatchDogs {
font-size: 70px;
line-height: 95px;
color: white;
background-color: rgba(0,0,0, .5);
display: inline;
}
关于css - CSS 中的文本背景,我们在Stack Overflow上找到一个类似的问题: https://stackoverflow.com/questions/25067125/