html - Why won't my nav element go to the center or change style? -


i trying nav element center won't work older versions of internet explorer or chrome. won't change style. how can center , change? here code:

the nav:

<nav id="nav">     <a href="tmr library.html">library</a> |     <a href="tmr contact.html">contact</a> |     <a href="tmr about.html">about</a> </nav> 

the css

#nav {     margin:0 auto;     font-size: 40px;     color: #22b14c;     font-family: "papyrus"; } 

there many ways centre elements:

margin way:

with set width or display: inline-block; can use:

margin-left: auto; margin-right: auto; 

text-align way:

with set width or display: inline-block; can add parent:

text-align: center; 

absolute way:

position: absolute; left: 50%; margin-left: width/2; 

or

position: absolute; left: 50%; transform: translate(0, -50%); 

also don't worry ie7 , below the majority of people use higher versions of ie or different browser though should work until ie6

another thing watch out want use ul navbar. know, experience, works fine though if ever want add drop-down navbar harder.


Comments

Popular posts from this blog

java.util.scanner - How to read and add only numbers to array from a text file -

rewrite - Trouble with Wordpress multiple custom querystrings -