CSS Fixed Menu – Pinned-Down Style
CSS is such a simple, but powerful mechanism for adding style to websites which makes your design options infinite. One of the most common uses of CSS is to create nice looking and useful menus for websites. We can create all kinds of different styles for menus: Horizontal, vertical, with drop down boxes, etc.
Pinned-Down Style
There’s another technique that I found to be very interesting and pretty cool to apply to our menus. It’s called Pinned-Down Style. Our menu is going to be in a fixed position on the page and when the user scrolls up and down the menu will float over the page at the position we defined.The XHTML Code:
...
<body>
<div class="banner">
<p>
<a href="#">Home</a>
<a href="#">About Us</a>
<a href="#">Our Activities</a>
<a href="#">Contact Us</a>
<a href="#/">Site Map</a>
<a href="#">Privacy</a>
<a href="#">Links</a>
<a href="#">Our Partners</a>
<a href="#">Articles</a>
</p>
</div>
...
</body>
This is just a paragraph with links that we are going to style with CSS. We can see the final result after we apply the following CSS code:
The CSS Code:
div.banner {
margin: 0;
font-size: 100% /*adjust to make the menu larger or smaller*/;
font-weight: bold;
line-height: 1.1;
text-align: center;
position: fixed;
top: 2em;
left: auto;
width: 8.5em;
right: 2em;
}
div.banner p {
margin: 0;
padding: 0.3em 0.4em;
font-family: Arial, sans-serif;
background: #990000;
border: thin outset #000;
color: white;
}
div.banner a, div.banner em { display: block; margin: 0 0.5em }
div.banner a, div.banner em { border-top: 2px groove #CCC }
div.banner a:first-child { border-top: none }
div.banner em { color: #CFC }
div.banner a:link { text-decoration: none; color: white }
div.banner a:visited { text-decoration: none; color: #CCC }
div.banner a:hover { background: black; color: white }


















raphael haefeli | portland, oregon freelance web design and … | Drakz Free Online Service wrote on January 15, 2010 @ 6:02 pm
[...] the original: raphael haefeli | portland, oregon freelance web design and … Share and [...]