Tutorials

Latest Word » Tutorials » CSS Vertical Navigation with Teaser
CSS Vertical Navigation with Teaser

CSS Vertical Navigation with Teaser

Tags:

This technique is a simple way to display some teaser information for your vertical navigation. I won’t waste any of your time with an intro, let’s get right into the code.

HTML

We will start by creating a list item, but in this case, we will add an empty ‘span’ tag inside of the hyper link. The CSS will look at the content of the span tag as a display: none until it’s hovered over.

<ul class="sidenav">
	<li>
		<a href="#">Home
		<span>Blandit turpis patria euismod at iaceo appellatio, demoveo esse. Tation utrum utrum abigo demoveo immitto aliquam sino aliquip. </span>
		</a>
	</li>
	<li>
		<a href="#">Blog
		<span>Blandit turpis patria euismod at iaceo appellatio, demoveo esse. Tation utrum utrum abigo demoveo immitto aliquam sino aliquip. </span>
		</a>
	</li>
	<li>
		<a href="#">Tutorials
		<span>Blandit turpis patria euismod at iaceo appellatio, demoveo esse. Tation utrum utrum abigo demoveo immitto aliquam sino aliquip. </span>
		</a>
	</li>
</ul>

CSS

We will first style the vertical navigation list. What I like to do is add a light bevel look on each of the navigation links.

ul.sidenav {
	font-size: 1.2em;
	float: left;
	width: 200px;
	margin: 0;
	padding: 0;
	list-style: none;
	background: #005094;
	border-bottom: 1px solid #3373a9;
	border-top: 1px solid #003867;
}
ul.sidenav li a{
	display: block;
	color: #fff;
	text-decoration: none;
	width: 155px;
	padding: 10px 10px 10px 35px;
	background: url(sidenav_a.gif) no-repeat 5px 7px;
	border-top: 1px solid #3373a9;
	border-bottom: 1px solid #003867;
}

Then we will now add the hide/show effect when it’s hovered.

ul.sidenav li a:hover {
	background: #003867 url(sidenav_a.gif) no-repeat 5px 7px;
	border-top: 1px solid #1a4c76;
}
ul.sidenav li span{	display: none; }
ul.sidenav li a:hover span {
	display: block;
	font-size: 0.8em;
	padding: 10px 0;
}

Bevel Colors

How did I choose the right colors to achieve the bevel look?

  1. Open Photoshop
  2. Create a new document of any size, I just did a random size of 300×300
  3. Fill the background with your <ul> base background color.
  4. Using your marquee tool, set it to the ‘single row marquee tool’
  5. Create a new layer and fill it with white
  6. Duplicate this layer but this time fill it with black.
  7. Now lower the opacity on those layers: Black Layer: 30% / White Layer 20%
  8. Now using the Eyedropper tool, select the two colors.

Bevel Effect - Photoshop
Bevel Effect - Photoshop

Conclusion

In addition to adding teaser information to the navigation, this technique can be modified to add descriptions to any element of page. You could add teaser descriptions to profile names, question-and-answer type FAQ pages, navigation, or a multitude of other applications.

Related Posts

Author Bio

My name is Soh Tanaka and I am a Los Angeles based designer/front-end developer specializing in CSS driven web design with an emphasis on usability and search engine optimization. I also run a CSS Gallery which is updated daily with the best CSS websites from around the world. Come check it out!

You can learn more about me or Twitter  Follow me on twitter for more updates and resources!

Did You Enjoy This Post?

subscribe  Subscribe via RSS or by email to get all upcoming tutorials and articles delivered straight to you.

+ Add Comment19 Peeps Have Spoken Their Minds...

  1. Patareco

    Another fine example of a good menu! Thanks for the share!

  2. Montana Flynn

    Soh, you have such a clean style! Thanks for this menu I’m thinking of modifying it to allow for a rating system as well as for a social media bookmark menu!

  3. Soh

    Thanks! I’m glad it was useful :-)

  4. John McCollum

    Entirely CSS based? Nicely done!

  5. Glomenth

    Is it possible to put links instead of the teaser text?

  6. Soh

    In order to add links I would suggest using a different technique and it involves a little bit of javascript.

    Due to IE6 not supporting hover effects on anything other than a link, you would have to use javascript and it cannot be pure css~

  7. sivas

    very good, thanks

  8. Daniel

    I’m sorry, I’m new to this, but you said you added an emptey ‘span’ tag into the hyperlink, but there’s text in the span tag i.e Blandit turpis patria euismod at iaceo appellatio, demoveo esse. Tation utrum utrum abigo demoveo immitto aliquam sino aliquip. I’m confused.

  9. Soh

    Sorry, I think I did a poor job explaining that portion, you wrap a span around your teaser copy (Not an empty span) :-) Let me know if you have any questions~

  10. bineet

    nice ……………..

  11. 小Y

    Good! Thank you for the tutorial

  12. stuart

    does this work in all browsers?

    are there any known issues in the main browsers such as IE 6, 7, 8, FF 3, Safari, Opera etc.

    Thank you and great effect

    Also – presumably it would be easy to place an image inside the span if one so wished? or am i mistaken?

    thank you

  13. нapминa

    Большое спасибо. Прочитал с интересом, и вообще полезный у Вас блог

  14. Sameer

    Thank you so much….

  15. Pratik Talati

    Thank you for such a nice article it helped me creating similar navigation. Keep up the good work.

  16. jarjar

    Thank you very much! it’s a damn cool thing!

  17. Ranjit

    very nice tutorial… Thanks

  18. bruce willis

    MANY THANKS
    but note: you should said the second layer above the first

  19. Fran Davies

    Thanks soh much!! lovely design and explained soh well.

Speak Your Mind...

Post HTMLNeed to Post HTML Code? Use Postable to post code friendly html. *Wrap all html code in <pre></pre> tags.
Post HTMLNeed to Keep Updated with Comments? Subscribe to comments now.

CSS Gallery