避免浏览器边上的滚动条

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特有的,使用起来也有种种弊端。

visible
This value indicates that content is not clipped, i.e., it may be rendered outside
the block box.
hidden
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.
scroll
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.
auto
The behavior of the ’auto’ value is user agent-dependent, but should cause a
scrolling mechanism to be provided for overflowing boxes.

你可能感兴趣的:(浏览器,css,IE)