Css: fixed positioning compatible with different series of browsers, including IE6.0

Source: Internet
Author: User
Rating: In the past, when we wanted to go back to the top, we had to scroll up the scroll wheel until it rolled to the top. Now we can see a button in the lower right corner to return to the top; today, I want to talk about the layout of this button. If you are interested, do not miss it. I hope this example can help you with the huge page content of many portal websites, which will be pulled down for a long time, in the past, when we wanted to go back to the top, we had to scroll up the scroll wheel until it rolled to the top. Now, if you carefully observe whether there was a button in the bottom right corner that clicked back to the top, right, today I want to talk about the layout of this button. I will not talk about it much, but I will directly add the code. I will try my best to mark the css style in the code for your convenience;

Copy code

The Code is as follows:

<! DOCTYPE html PUBLIC "-// W3C // dtd xhtml 1.0 Transitional // EN" "http://www.w3.org/TR/xhtml1/DTD/xhtml1-transitional.dtd">
<Html xmlns = "http://www.w3.org/1999/xhtml">
<Head>
<Meta http-equiv = "Content-Type" content = "text/html; charset = UTF-8"/>
<Title> fixed positioning to solve the IE6 flash problem </title>
<Style type = "text/css">
* Html {
Background-image: url (about: blank );
Background-attachment: fixed;
}/* This code solves the problem that IE6.0 does not flash */
. BackgroundBox {
Border: 1px solid orange;
Width: 100px;
Height: 2000px;
}
. FixedBox {
Border: 1px solid red;
Width: 100px;
Height: 100px;
Position: fixed;/* supports w3c standard browsers */
_ Position: absolute;/* For IE6 separately */
Left: 200px;/* 200px from the top */
Top: 200px;/* 200px to the right */
_ Top: expression(eval(document.doc umentElement. scrollTop + 200);/* + 200 is the position below IE6.0 from the top of the browser window */
/* The distance from the bottom of IE6.0 is 0 PX */
/* _ Top: expression(eval(document.documentElement.scrollTop+document.doc umentElement. clientHeight-this.offsetHeight-(parseInt (this. currentStyle. marginTop, 10) | 0)-(parseInt (this. currentStyle. marginBottom, 10) | 0 )));*/
}
</Style>
</Head>
<Body>
<Div class = "backgroundBox"> </div>
<Div class = "fixedBox"> fixed box </div>
</Body>
</Html>

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.