I saw this on a website and looked a bit through the CSS, but couldn't quite find what I am looking for.

How to make an Html element let's say a <div> with a width of eg. 3000px, but make it so that page doesn't put up scrollers automatically so that you can scroll to the rightmost and see the end of that content?

In case the page is resized to, let's say resolution smaller then 800x600, scrollbars appear (because the MAIN content is bigger than that), but they only let you scroll and see the MAIN content, not the rightmost part of the said <div>.

So basically, how to make a browser ignore an element's width or height no matter how big or small it is?

3 Answers 3


You apply the sizes for the div using CSS styles. You can do them inline or in a stylesheet document (recommonended)

Its hard to do a proper design that reaches all monitor widths. You see this for admin interfaces, or online maps, but most popualr websites have around a 960px width.

An approach you can do with CSS is: min-width:600px, max-widht:1200px;. This will make a div that has to be at least 600px fat and wont get fatter than 1200px. The problem is if a website gets too fat, and someone opens it up on a 1920x1200 screeen or 2560x1600 screen then the website looks really funny.

In anycase, be careful with this type of design. Usually the width of this web page is the best choice .


found it... i anyone else has the same problem, the solution is min-width and min-height...

  • 2
    min-width and min-height are not compatible in every browser. Older ones like IE6 disregard these so you'll want to set a height and width specifically for them.
    – XOPJ
    Oct 20, 2010 at 16:05

Width and max-height properties will ensure that:

  1. An element is never wider or taller than the value you set, even if there's enough room on the page for it to take up more space.

  2. An element is never narrower or shorter than the value you set, even if the browser window is too small to display the whole element. Referred more

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service and acknowledge you have read our privacy policy.

Not the answer you're looking for? Browse other questions tagged or ask your own question.