避免浏览器边上的滚动条

CSS 2.1

overflow
Value: visible | hidden | scroll | auto | inherit
Initial: visible
Applies to: non-replaced block-level elements, table cells, and
inline-block elements
Inherited: no
Percentages: N/A
Media: visual
Computed value: as specified

IE缺省会在右边显示一个竖直滚动条。但是这个实现与我的期望不一致。我希望内容不足以撑开页面高度的时候,这个竖直滚动条不要显示。

或者说body.overflow缺省取值是visible,我希望他是auto。

以往的处理方式往往是设置 body.scroll = no或者body.scroll=auto,这个scroll属性是IE特有的,使用起来也有种种弊端。

[i][b]visible [/b][/i]
This value indicates that content is not clipped, i.e., it may be rendered outside
the block box.
[i][b]hidden [/b][/i]
This value indicates that the content is clipped and that no scrolling user
interface should be provided to view the content outside the clipping region.
[i][b]scroll [/b][/i]
This value indicates that the content is clipped and that if the user agent uses a
scrolling mechanism that is visible on the screen (such as a scroll bar or a
panner), that mechanism should be displayed for a box whether or not any of its
content is clipped. This avoids any problem with scrollbars appearing and
disappearing in a dynamic environment. When this value is specified and the
target medium is ’print’, overflowing content may be printed.
[i][b]auto [/b][/i]
The behavior of the ’auto’ value is user agent-dependent, but should cause a
scrolling mechanism to be provided for overflowing boxes.
發表評論
所有評論
還沒有人評論,想成為第一個評論的人麼? 請在上方評論欄輸入並且點擊發布.
相關文章