tags:

views:

31

answers:

2

I need a DIV to have constant width, regardless showing the scroll bar.

This is what I have so far:

<div style="overflow: auto; width:100%; height: 100px;">

How should this be changed ?

+3  A: 

The overflow style has a scroll property which does what you want. You may also want to split it out into overflow-x and overflow-y to allow you to control the two scrollbars independantly:

div {
  width:100%;
  height:100%
  overflow-x:scroll;
  overflow-y:scroll;
}

Change the x or y overflow to none or auto depending on what combination of scroll bars you need.

Spudley
Please see my reply to Pekka
sdiv
A: 

To get a constant width, specify a pixel value:

<div style="overflow: auto; width:200px; height: 100px;">
Pekka