[英]Extending an underline in CSS
Is it possible to over extend and underline so that it goes further than the word itself? 是否有可能过度延伸和下划线,以便它比单词本身更进一步?
Like so: 像这样:
I tried: 我试过了:
.numbers u {
width:200px;
}
I was hoping it would work but I got nothing. 我希望它会起作用,但我一无所获。
Is there some sort of css trick to make this possible? 是否有某种css技巧可以实现这一目标?
You can use content
property with :after
pseudo, if you do not want to use this, than you need to feed
你可以使用content
属性:after
伪,如果你不想使用它,那么你需要提供
on each u
tag 在每个u
标签上
.numbers u:after {
content: "\00a0\00a0\00a0\00a0";
}
Info: What's 00a0 here? 信息:这是什么00a0? It's a Non Break Space 这是一个非休息空间
Can also use something like 也可以使用类似的东西
.numbers u:after {
content: "................";
color: transparent;
}
Demo 2 (But I would prefer \\00a0
one..) 演示2 (但我更喜欢\\00a0
一个..)
As far as browser support goes, content
as well as :after
are supported in IE8, Side note, ::after
is supported in IE9 but using :after
is just fine here. 至于浏览器支持, content
以及:after
在IE8中支持,Side note, ::after
在IE9中支持但使用:after
就好了。 so support shouldn't matter much. 所以支持不应该太重要。
No. You need to put a border-bottom
and extend the width of the p
where the text exists. 不需要。您需要设置border-bottom
并扩展文本所在的p
的宽度。
The HTML: HTML:
<p class="underline">One</p>
The CSS: CSS:
.underline{border-bottom:1px solid #000000; width:200px; padding-bottom:5px;}
Hope this helps. 希望这可以帮助。
声明:本站的技术帖子网页,遵循CC BY-SA 4.0协议,如果您需要转载,请注明本站网址或者原文地址。任何问题请咨询:yoyou2525@163.com.