CSS Navigation Bar


CSS navigaiton bar - horizontal and vertical.

Horizontal navigation bar

CSS code:

<style>
    #h_nav_bar a { padding:15px; font-weight:bold; float:left; }
    #h_nav_bar a:link { color:#d0d0d0; background-color:#0000a0; }
    #h_nav_bar a:visited { color:#c0c0c0; background-color:#0000a0; }
    #h_nav_bar a:hover { color:#ffffff; background-color:#000060; }
    #h_nav_bar a:active { color:#f0f0f0; background-color:#00ff00; }
</style>

HTML code:

<div id="h_nav_bar">
    <a href="html-anchor-link.htm">Anchor link</a>
    <a href="html-link-color.htm">Link color</a>
    <a href="../mailto.htm">Email link</a>
    <a href="html-image-link.htm">Image link</a>
    <a href="html-text-link.htm">Text link</a>
</div>

View:

 

 

 

#link_bar a is the style for all states of the link.

#link_bar a:link is the style of regular link.

#link_bar a:visited is the style of visited link.

#link_bar a:hover is the style of mouse hovered link.

#link_bar a:active is the style of link when pressed by the mouse.

Vertical navigation bar

CSS code:

<style>
    #v_nav_bar a { padding:15px; font-weight:bold; display:block; width:120px; }
    #v_nav_bar a:link { color:#d0d0d0; background-color:#0000a0; }
    #v_nav_bar a:visited { color:#c0c0c0; background-color:#0000a0; }
    #v_nav_bar a:hover { color:#ffffff; background-color:#000060; }
    #v_nav_bar a:active { color:#f0f0f0; background-color:#00ff00; }
</style>

HTML code:

<div id="v_nav_bar">
    <a href="html-anchor-link.htm">Anchor link</a>
    <a href="html-link-color.htm">Link color</a>
    <a href="../mailto.htm">Email link</a>
    <a href="html-image-link.htm">Image link</a>
    <a href="html-text-link.htm">Text link</a>
</div>

View:

 

#link_bar a is the style for all states of the link.

#link_bar a:link is the style of regular link.

#link_bar a:visited is the style of visited link.

#link_bar a:hover is the style of mouse hovered link.

#link_bar a:active is the style of link when pressed by the mouse.

 

 


See also


CSS
CONTACT