CSS:多行文本上的背景颜色? [英] CSS : Background-color on multi-line text?
本文介绍了CSS:多行文本上的背景颜色?的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!
问题描述
您有一个想法在多行文本中添加background-color属性,但有两个困难:
- 背景必须在每行最后一个字后停止
- 每行之间没有空格。
示例:
谢谢!
解决方案
我认为这是您要找的: http://jsfiddle.net/9BTYQ/1/
html
< div>< span>你有一个想法在多行上添加background-color属性文字,有两个困难:< / span>< / div>
css
span {
color:white;
background-color:#343132;
box-shadow:0.5em 0 0#343132,-0.5em 0 0#343132;
}
div {width:100px; }
Do you have an idea to add a "background-color" property on a multi-line text, with two difficulties:
- Background must stop after the last word of each line
- No space between each line without background
Example :
Thanks !
解决方案
I think this is what you are looking for: http://jsfiddle.net/9BTYQ/1/
html
<div><span>Do you have an idea to add a background-color property on a multi-line text, with two difficulties:</span></div>
css
span {
color: white;
background-color: #343132;
box-shadow: 0.5em 0 0 #343132,-0.5em 0 0 #343132;
}
div { width: 100px; }
这篇关于CSS:多行文本上的背景颜色?的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!
查看全文