Naor
Naor

Reputation: 24053

div with screen width and with scroling

I would like to create a div that will have the screen width (any screen) and if the content is out of the screen width - I want to display horizontal scroll bar. How can I achieve this?

Upvotes: 0

Views: 637

Answers (2)

Anish
Anish

Reputation: 2917

you can use like this....

#width1
{
height:200px;
border:1px solid black;
width:100%;
overflow:auto;
}

<div id="width1"></div>

Have a look at this fiddle:http://jsfiddle.net/Laqqn/1/

Upvotes: 0

ccsakuweb
ccsakuweb

Reputation: 789

The scroll will appear in the div if the div content is bigger if you add the next style to the div container:

overflow: auto;

And if you want to dont display the vertical scroll you need:

overflow-y: hidden;

Upvotes: 2

Related Questions