markzzz
markzzz

Reputation: 47945

CSS - use a horizontal scrollbar only

i need to use an horizontal scollbar only if the content of the div is longer than the width value.

so i write :

.viewgallerylist{width:920px; float:left; padding-top:20px; height:120px; border-bottom:1px #000000 solid; overflow-x: scroll;}

the problem is that the scrollbar are 2, 1 horizontal and 1 vertical. How to remove the vertical one? cheers

Upvotes: 5

Views: 11044

Answers (4)

Blaise
Blaise

Reputation: 13479

.viewgallerylist {
    min-width: 920px;
    overflow: hidden;
    -ms-overflow-x: auto; /* IE8 */
    overflow-x: auto;
}

(min-width doesn't work in IE6, in case you still want to support that dinosaur)

Upvotes: 11

Alexander_F
Alexander_F

Reputation: 2879

overflow-x:scroll creates a horizontal scrollbar if the content exceeds the width of the container. overflow-y:scroll creates a vertical scrollbar if the contents exceeds the height of the container.

Upvotes: 4

casablanca
casablanca

Reputation: 70701

Use overflow-y: hidden.

Upvotes: 2

Yi Jiang
Yi Jiang

Reputation: 50095

Try

.viewgallerylist {
  overflow-y: hidden;
}

Upvotes: 3

Related Questions