Div to Fill Remaining Width
-
19-02-2021 - |
Question
I'm trying to make this blue line (a div) automatically fill the rest of the space The width of the container is fixed to 800px but the h1 changes width depending on the length of the text.
About us
is longer thanServices
etc.I can use something like 80% percent and it works but it doesn't fill the remaining and looks ugly...
How would you do that?
Thanks
Solution
You could simply make the line the width of the overall box but then hide the overflow:
OTHER TIPS
You could have a line that goes across the whole container, and have a background color on the text that hides the line.
An easy way would be to make the line 100% of the width, and position the text over it with an opaque background.
Licensed under: CC-BY-SA with attribution
Not affiliated with StackOverflow