simple question
if I make a div with border all way round with some text in, the div box will only be as wide as the content.
how do I make it that the div always stretches 100% of the screen across, even if nothing inside it.
I understand min-width doesnt work with IE, is there a safe, stable way to do this?
No, a
<div>will always take up the 100% of width unless a style(css) alters it.Keep in mind that a
<div>is ablockelement.If you set the display value of
<div>to beinline, for example, it would only take up the width of its content.Example:
On the otherhand,
A
<span>will only take up as much width as the context because its aninlineelement.Here is an example.
jsFiddle