How to set the navigation bar to the top and center in html5, edit html, how to fix the navigation bar at the bottom of the web page and move with the screen? ...

The navigation bar is fixed at the bottom and moves with the browser;

Tools/Materials

Required CSS styles: position:fixed;z-index:999;left:0;right:0;bottom:0;

normal navigation,

Method/Step 1:

Principle: It can be done through CSS styles

position:fixed;

Generates absolutely positioned elements, positioned relative to the browser window.

The position of the element is specified by the "left", "top", "right" and "bottom" properties.

Method/Step 2:

If you use fixed, there will be a lower priority level, which will cause it to be covered by other divs. Then you need to use z-index: 999; here to make it the highest level, so that it will not be covered. 999 is just a number, you can feel free to use it. Change, higher than others can be;

Method/Step 3:

Positioning: left: 0; right: 0; bottom: 0;

Once these three styles are written, they can be pinned to the bottom and centered. don't write top:0;

Method/Step 4:

div section:

front page

List

Content page

Method/Step 5:

CSS style section:

.a1 {

margin: auto;

padding:0;

list-style: none;

font-size:14px;

width:1020px;

position:fixed;

z-index:999;

bottom:0px;

left:0;

right:0;

}

Precautions

The style should be applied to, not applied to it, there will be stacking

The value of z-index does not have to be 999, it can be larger than others;

After the style is added to float, do not clear it in the div, so that it will not affect the layout;

Guess you like

Origin http://10.200.1.11:23101/article/api/json?id=324114546&siteId=291194637