Question

To underline text in CSS we can do:

h3 {text-decoration:underline;}

However this only underlines the text enclosed in h3 tag. What if want the underline to go across the page?

Thanks

Was it helpful?

Solution

Then you wouldn't have an underline, you'd have a border on the element.

border-bottom: 1px red solid;

OTHER TIPS

You could try using a border:

h3 { border-bottom: 1px solid }

Assuming your element lies directly under the body tag you can use:

h3 {
    width: 100%;
    border-bottom: 1px solid red;
}

And the line will span across the entire page, or whatever element it is within...

Maybe try the horizontal rule (hr) tag? This can also be stylized however you'd like.


Licensed under: CC-BY-SA with attribution
Not affiliated with StackOverflow
scroll top