Reprinted: Page scroll bar processing

Source: Internet
Author: User
When I encountered a problem in the IFRAME scroll bar today, the slide will be displayed in IFRAME if the content does not exceed the vertical scroll bar on the right of the page range. When the page content exceeds the page height, A vertical scroll bar is displayed on the slide. When the content does not exceed the range, the vertical scroll bar and slide are not displayed, so that the page content expands to the rightmost; only when the page content exceeds the page height, the slide and vertical scroll bar are displayed! Searched online and recorded

Some useful information from Google:

[Div + CSS] bar in XHTML
1.what is the color of the scroll bar in XHTML?

In the original HTML, we can define the scroll bar of the entire page in this way.

Body {
Scrollbar-3dlight-color: # d4d0c8;/*-outermost left -*/
Scrollbar-Highlight-color: #000;/*-second left -*/
Scrollbar-face-color: # e4e4e4;/*-face -*/
Scrollbar-arrow-color: #666;/*-arrow -*/
Scrollbar-shadow-color: #808080;/*-right 2 -*/
Scrollbar-darkshadow-color: # d7dce0;/*-right one -*/
Scrollbar-base-color: # d7dce0;/*-base color -*/
Scrollbar-track-color: #;/*-slide -*/
}

But the sameCodeOur application does not work under XHTML. I believe many good friends have encountered the same problem.
So how can I apply the scroll bar style in XHTML? See the following code

HTML {
Scrollbar-3dlight-color: # d4d0c8;/*-outermost left -*/
Scrollbar-Highlight-color: #000;/*-second left -*/
Scrollbar-face-color: # e4e4e4;/*-face -*/
Scrollbar-arrow-color: #666;/*-arrow -*/
Scrollbar-shadow-color: #808080;/*-right 2 -*/
Scrollbar-darkshadow-color: # d7dce0;/*-right one -*/
Scrollbar-base-color: # d7dce0;/*-base color -*/
Scrollbar-track-color: #;/*-slide -*/
}

The only difference between this code and the previous one is that on the elements defined by CSS, one is body and the other is HTML. Let's test it again.
Modify "body" to "html" and test the function. Why?

Both HTML and XHTML are passed, because * is to define any tag on the page, including the "html" tag.

(PS: in fact, it is not so much the difference between HTML and XHTML that there is no difference between XHTML 1.0 transitional doctype, But if you
If the XHTML 1.0 transitional doctype is removed, there will be no doctype on this page. The default display method is html4.01,
You need to change XHTML 1.0 transitional doctype to HTML 4.01 doctype. Similarly, the page definition body does not work, although
The standard for this page is HTML 4.01)

2.what is the problem about the horizontal scroll bar of the frame page under XHTML?

When you use IE6 to browse the XHTML page with a framework, the system displays the horizontal and vertical scroll bars by default. This is
Bug. It is normal on Firefox because it has a defect in interpreting XHTML 1.0 transitional doctype.

There are generally three solutions for this bug,

Method 1:
Code:
HTML {overflow-Y: Scroll ;}
Principle: forcibly display the vertical scroll bar of IE, while ignoring the horizontal scroll bar
Advantage: completely solves this problem and allows you to maintain the complete XHTML doctype.
Disadvantage: even if the page does not require a vertical scroll bar, a vertical scroll bar appears.

Method 2:
Code:
HTML {overflow-X: hidden; overflow-Y: auto ;}
Principle: Hide horizontal scrolling. Vertical scrolling is adaptive to content
Advantage: this problem is solved visually. When it is not necessary, the vertical scroll bar is not forced to appear.
Disadvantage: the horizontal scroll bar is hidden. If the horizontal scroll bar is required,
Content outside the screen is invisible because the user cannot scroll horizontally.

Method 3:
Code:
Body {margin-Right:-15px; margin-bottom:-15px ;}
Principle: this will add a negative value to the horizontal and vertical directions of margin. After ie adds this exact value, it will remove the illusion of requiring the scroll bar.
Advantage: this problem is solved visually. Vertical scrolling is adaptive based on content.
Disadvantage: Because the 15px margin (margin) is created manually, this filled screen area cannot be used.

From: http://hi.baidu.com/sandmax/blog/item/43fd0e4668dbc6096b63e59f.html

Attachment: Forced scroll bar:

The bug fixing technique can also be used for other purposes. With CSS, You can effectively display or hide vertical and horizontal scroll bars in Mozilla Firefox and Internet Explorer.

Force display of the scroll bar:

HTML {overflow: Scroll ;}

Force hide the scroll bar:

HTML {overflow: hidden ;}

Hide the horizontal scroll bar of IE:

HTML {overflow-X: hidden ;}

Hide the vertical scroll bar of IE:

HTML {overflow-Y: hidden ;}

Forcibly display the horizontal scroll bar of IE:

HTML {overflow-X: Scroll ;}

Forcibly display the vertical scroll bar of IE:

HTML {overflow-Y: Scroll ;}

Force display of Mozilla horizontal scroll bar:

HTML {overflow:-moz-scrollbars-horizontal ;}

Note: Only the horizontal scroll bar is forcibly displayed. That is to say, even if the vertical scroll bar needs to be displayed, the vertical scroll bar will not appear.

Force display of Mozilla's vertical scroll bar:

HTML {overflow:-moz-scrollbars-vertical ;}

Note: Only the vertical scroll bar is displayed. That is to say, the horizontal scroll bar does not appear even if the horizontal scroll bar needs to be displayed.

Contact Us

The content source of this page is from Internet, which doesn't represent Alibaba Cloud's opinion; products and services mentioned on that page don't have any relationship with Alibaba Cloud. If the content of the page makes you feel confusing, please write us an email, we will handle the problem within 5 days after receiving your email.

If you find any instances of plagiarism from the community, please send an email to: info-contact@alibabacloud.com and provide relevant evidence. A staff member will contact you within 5 working days.

A Free Trial That Lets You Build Big!

Start building with 50+ products and up to 12 months usage for Elastic Compute Service

  • Sales Support

    1 on 1 presale consultation

  • After-Sales Support

    24/7 Technical Support 6 Free Tickets per Quarter Faster Response

  • Alibaba Cloud offers highly flexible support services tailored to meet your exact needs.