CSS在换行之前创建填充 [英] CSS create padding before line-break
本文介绍了CSS在换行之前创建填充的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!
问题描述
是否可以在换行之前添加填充?像这样,从到此。
Is it possible to add padding before line-break? As in, making from this to this .
当前CSS代码:
span.highlight { background: #0058be; color: #FFF; padding: 2px 5px; }
推荐答案
这可以通过纯CSS来完成。c> margin-left:0; 在相同颜色的高亮区域的左侧和右侧创建一个固定的 box-shadow
(并使用 margin
间距)。对于您的情况:
This can be done with pure CSS. Create a solid box-shadow
to the left and right of the highlight in the same color (and use margin
to correct the spacing). For your case:
span.highlight {
background: #0058be;
color: #FFF;
box-shadow:5px 0 0 #0058be, -5px 0 0 #0058be;
padding: 2px 0;
margin:0 5px;
}
这篇关于CSS在换行之前创建填充的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!
查看全文