drasto drasto - 1 year ago 70
HTML Question

How to limit width of html site?

How do I set the width of a web page to always be exactly 1000px ? For example, like Facebook or here on StackOverflow. The site just will not resize. If the browser window is smaller than 1000px, the scroll bar is needed. And the page should be centered in the browser.

I can always put content of the page inside

tags, but I have read that it will not work for all browsers. So what is the right way to do it ?

Answer Source

Enclosing the content in a div that has the CSS width property set to 1000px will work across browsers.


div.content { width: 1000px }


  <div class="content">

However, consider using 960 pixels instead of 1000. It is a reliable standard that works on most devices down to a 1024 pixel display width including space for scroll bars and such.

Recommended from our users: Dynamic Network Monitoring from WhatsUp Gold from IPSwitch. Free Download