Printable Version of Topic

Click here to view this topic in its original format

HTMLHelp Forums _ Markup (HTML, XHTML, XML) _ Make a DIV element the width of the page

Posted by: jeak Jun 20 2012, 09:09 AM

I have a DIV element at the top of my page, and another beneath. I'd like the top DIV to always cover the entire width of the page, even if the browser window width is less than the width of the second DIV element. How would I do this? Sample of what I'm currently doing below.

<html>
<body style="padding:0px; margin:0px;">

<div style="background-color:#123456; width:100%;">top</div>
<div style="background-color:#654321"><IMG style="width:1000px; height:1000px;"></div>
</body>
</html>

Posted by: Frederiek Jun 21 2012, 02:18 AM

Set a min-width of say 100em to the top div.

Posted by: jeak Jun 21 2012, 06:47 AM

Brilliant, thank-you.

Posted by: Frederiek Jun 21 2012, 06:52 AM

You're welcome.

Powered by Invision Power Board (http://www.invisionboard.com)
© Invision Power Services (http://www.invisionpower.com)