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;
}
FIDDLE
I was hoping it would work but I got nothing.
Is there some sort of css trick to make this possible?
You need to put a border-bottom and extend the width of the p where the text exists. Hope this helps. Show activity on this post. I only want the line for top number, is it possible to use your example but set a p class to just the top number?
Press and hold this keyboard shortcut combination to add multiple underlines next to each other, creating an underline. For example, holding down Ctrl + Shift and pressing the Spacebar five times would create an underline five characters long.
Steps: Create background image with linear-gradient() . Adjust its size with css background-size property. Place it at the bottom left position of the element with background-position css property.
In the horizontal text we use text-underline-position: under; to put the underline below all the descenders. In the text with a vertical writing-mode set, we can then use values of left or right to make the underline appear on the left or right of the text as required.
You can use content
property with :after
pseudo, if you do not want to use this, than you need to feed
on each u
tag
.numbers u:after {
content: "\00a0\00a0\00a0\00a0";
}
Demo
Info: What's 00a0 here? 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..)
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. 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.
WORKING DEMO
The HTML:
<p class="underline">One</p>
The CSS:
.underline{border-bottom:1px solid #000000; width:200px; padding-bottom:5px;}
Hope this helps.
Use a border rather than underlining. Use the first-child
pseudo class to apply it to only the first paragraph within .numbers
:
.numbers p:first-child {
width:200px;
border-bottom:1px solid #000;
padding-bottom:1px;
}
JSFiddle
If you love us? You can donate to us via Paypal or buy me a coffee so we can maintain and grow! Thank you!
Donate Us With