开发者

div height vertical scrollbar

My current page looks like this:

div height vertical scrollbar

I would like to do that vertical scrollbar is always showed(when the page is too large). Horizontal scrollbar should be at the bottom of browser like this:

div height vertical scrollbar

How can I this. I hope I explained.

HTML

<body>
  <div id="top">This is the top div</div>
  <div id="main">
   This is the main content area. This is the main content area.....
   .... aaaaa...
  </div>
 </body>

css

body{
 width: 100%;
 margin: 0px;
 padding: 0px;
}

#top{
 text-align: center;
 background开发者_开发百科-color: #FF0;
 height: 100px;
 position: relative;
 top: 0px;
}

#main{
 background-color: silver;
 overflow: auto;
}

Updated

I made this: http://85.10.35.158/. The only problem is that I can't make the width of #content the same as the width of #header.

div height vertical scrollbar

I tried with jQuery:

var width = $(document).width() - $('#header').width();
$('#content').css('width', width);

but I don't like that javascript is used for design. Is there any way it can be done with CSS. Maybe css3.


You want to take a look at the overflow CSS property: http://www.w3schools.com/cssref/pr_pos_overflow.asp

0

上一篇:

下一篇:

精彩评论

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

最新问答

问答排行榜