Fixed floating navigation bar at the bottom of the webpage

Source: Internet
Author: User

Some things are difficult to find, and they are even more difficult to find. I have seen many fixed floating navigation bars written in JS before. This effect will inevitably cause jitter when being dragged.

I still like CSS very much. I found it and found the world. Take a closer look.Pure CSSOfCode. Js effect is not used.

I think it is simpler than what I saw before, without having to nest extra Divs.

A simple look at the CSS style section:

Reference content is as follows:

Body {
Background-image: url(text.txt);/* For IE6 */
Background-Attachment: fixed;
}
# Bottomnav {
Background-color: #096;
Z-index: 999;
Position: fixed;
Bottom: 0;
Left: 0;
Width: 100%;
_ Position: absolute;/* For IE6 */
_ Top: expression (documentelement. scrolltop + documentelement. clientHeight-this.offsetHeight);/* For IE6 */
Overflow: visible;
}

Add the div id # bottomnav to the HTML part:

Reference content is as follows:

<Div id = "bottomnav"> fixed floating object O (cost _ attention) O ~ </Div>

Let's take a look at the notes:

Reference content is as follows:

_ Top: expression (documentelement. scrolltop + documentelement. clientHeight-this.offsetHeight );

We all know that _ top is exclusively prepared for IE6, but when I only add the above sentence, IE6 pulls the floating thing that the scroll bar sees as jitters.

Solution: add the following statement to IE6:

Reference content is as follows:

Background-image: url(text.txt );

Note that text.txt does not need to have this TXT file. The TXT file name can be regarded as your preferences, so we can solve the easing problem in IE6.

PS: You may be frustrated with text.txt and expression. Some people use multiple nested Div layers to implement a false scroll bar, of course, this method will also change the default attributes accordingly. However, this write method is very depressing when it is integrated with previous websites. You need to add a div (because I didn't write a DIV in the outermost layer before. WRAP ).

In contrast, I prefer pure CSS writing like Tianya. Here isDemo.

Fixed floatingSelect the reason for writing as follows:

Reference content is as follows:

The pure CSS syntax avoids the embarrassing scenes of website reconstruction troubles caused by the creation of fake scroll bars by nesting an external Div layer.
At the same time, there will be no Jitter Caused by JS floating.

It may be betterFixed floating navigationI didn't find out. If you have more and better methods, don't forget to tell me!

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.