开发者

div with screen width and with scroling

开发者 https://www.devze.com 2023-03-05 19:12 出处:网络
I would like to create a div that w开发者_开发问答ill 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

I would like to create a div that w开发者_开发问答ill 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?


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;


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/

0

精彩评论

暂无评论...
验证码 换一张
取 消