【发布时间】:2012-06-25 08:24:16
【问题描述】:
我有一个文本块,我需要为各个行提供背景颜色,中间有空格。
我已经部分实现了
<div class="styleText">
<span class="spaced">Lorem Ipsum is simply dummy text of the printing and typesetting industry. Lorem Ipsum has been the industry's standard dummy text ever since the 1500s, when an unknown printer took a galley of type and scrambled it to make a type specimen book.</span>
</div>
.
.styleText .spaced{
background: rgba(0,0,0,6.5);
line-height: 1.2em;
/*width: 421px;*/
}
但是,我需要所有行的宽度相同,并且希望在每行的开头和结尾以及顶部和底部进行填充。
谁能想到一种方法来实现这种效果,或者我唯一的选择是对 styleText 类使用一些背景图片技巧?
【问题讨论】:
-
不,你不能只用 CSS 做到这一点。填充仅应用于块元素,您的行肯定不是块..
-
你能添加一张你想要达到的结果的图片吗?我很难理解你需要什么