CSS navigation bar: http://www.w3school.com.cn/css/css_navbar.asp#
The navigation bar is basically a list of links, so it's very appropriate to use <ul> and <li> elements:
1 Horizontal navigation bar: (The width of the link in this example is different)2 <! DOCTYPE html>3 4 5 <style>6 ul7{8 List-style-type:None;9 margin:0;Ten padding:0; One Padding-top:6px; A Padding-bottom:6px; -} - Li the{ - Display:inline; -} - a:link,a:visited +{ - Font-weight:Bold; + Color:#FFFFFF; A Background-color:#98bf21; at text-align:Center; - padding:6px; - text-decoration:None; - Text-transform:Uppercase; -} - a:hover,a:active in{ - Background-color:#7A991A; to} + - </style> the
Horizontal navigation bar 2:<! DOCTYPE Html>{List-style-type:None;margin:0;padding:0;Overflow:Hidden;}Li{float: Left;}a:link,a:visited{Display:Block;width:120px;Font-weight:Bold;Color:#FFFFFF;Background-color:#bebebe;text-align:Center;padding:4px;text-decoration:None;Text-transform:Uppercase;}a:hover,a:active{Background-color:#cc0000;}</style>
Horizontal navigation bar 3:<! DOCTYPE Html>{List-style-type:None;margin:0;padding:0;Overflow:Hidden;}Li{float: Left;}a{Display:Block;width:60px;Background-color:#dddddd;text-decoration:None;//Remove the underline from the A label}</style>
Horizontal navigation bar 4:<! DOCTYPE Html>{List-style-type:None;margin:0;padding:0;Overflow:Hidden;}Li{float: Left;}a:link,a:visited{Display:Block;width:60px;Font-weight:Bold;Color:#FFFFFF;Background-color:#bebebe;text-align:Center;text-decoration:None;Text-transform:Uppercase;//English to uppercase}a:hover,a:active{Color:#cc0000;}</style>
Vertical navigation bar <! DOCTYPE Html>{List-style-type:None;margin:0;padding:0;}a:link,a:visited{Display:Block;Font-weight:Bold;Color:#FFFFFF;Background-color:#bebebe;width:120px;text-align:Center;padding:4px;text-decoration:None;Text-transform:Uppercase;}a:hover,a:active{Background-color:#cc0000;}</style>
<body><ul><li><a href= "#home" >home</a></li><li><a href= "#news" > News</a></li><li><a href= "#contact" >contact</a></li><li><a href= "# About ">About</a></li></ul><p><b> Note:</b> If you set the padding for a element only (without setting the UL element), the link appears in the Beyond the UL element. So, we added top and bottom padding for the UL element. </p></body>
CSS Navigation bar