开发者

Wide div - can I get rid of scrollbars somehow?

I have a wide div that has background image. The div is 1100px wide and when browser window is less than that, theres scrollbars. Is there any ways to avoid the scrollbars? Thats isnt any hack. Now I know I could put it in body image, but I would like to have it this div for a reason.

<body>
<div id="imgWrapper"> <-the wide div the image
<div id="wrapper"> <- normal 960px wrapper
<div id="content"> <- content inside this
Blablabla......
</div>
</div>
</body>

But ofcourse if the contnet ins开发者_C百科ide that #container/#content is wider than the browser window than I want scrollbars.


Use overflow:hidden or overflow:auto.

There are also variations for each axis ,overflow-x: and overflow-y: with the same properties (hidden, visible, and auto).


To suppress scrollbars, use the CSS overflow (which controls both vertical and horizontal scrollbars; use overflow-x and overflow-y for individual scollbar control) property on your divs: http://www.w3schools.com/Css/pr_pos_overflow.asp


alternatively, you can also drop div#imgWrapper from your html, and give #wrapper a css background.

<body>
 <div id="wrapper"> <- normal 960px wrapper
 <div id="content"> <- content inside this
  Blablabla......
 </div>
 </div>
</body>

css

#wrapper { background: url(path/to/someimage.png) transparent 0 0 no-repeat;
0

上一篇:

下一篇:

精彩评论

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

最新问答

问答排行榜