freewheeler
freewheeler

Reputation: 1356

Is it possible to use combined overflow CSS/JS?

I'm looking for a solution for combining different x and y overflow.

Following code:

 div {
 overflow-x: visible;
 overflow-y: hidden;
 }

doesn't work. I want a simple method to hide horizontal scrollbar, keeping the vertical overflown content visible. I do not want to change the DIV's height in layout. Any tricks?

Upvotes: 0

Views: 80

Answers (2)

Nitesh
Nitesh

Reputation: 15739

Use the below.

div {
 overflow-x: hidden;
 overflow-y: scroll;     
 }

WORKING DEMO

The HTML Code:

<div>This is a div.</div>

The CSS Code:

div {
 overflow-x: hidden; 
 overflow-y: scroll;
 display:inline-block;
 }

Hope this helps.

Upvotes: 0

Bhojendra Rauniyar
Bhojendra Rauniyar

Reputation: 85545

I want a simple method to hide horizontal scrollbar, keeping the vertical overflown content visible.

for horizontal -> overflow-x
for vertical   -> overflow-y

You could just use

div{
overflow-x: hidden;
overflow-y: auto; // if you don't want scrollbar use visible
}

Upvotes: 1

Related Questions