<?xml version="1.0" encoding="UTF-8"?>
<rss version="2.0"
	xmlns:content="http://purl.org/rss/1.0/modules/content/"
	xmlns:wfw="http://wellformedweb.org/CommentAPI/"
	xmlns:dc="http://purl.org/dc/elements/1.1/"
	xmlns:atom="http://www.w3.org/2005/Atom"
	xmlns:sy="http://purl.org/rss/1.0/modules/syndication/"
	xmlns:slash="http://purl.org/rss/1.0/modules/slash/"
	>

<channel>
	<title>Dave PC Guy &#187; navigation</title>
	<atom:link href="http://www.davepcguy.com/archive/tag/navigation/feed/" rel="self" type="application/rss+xml" />
	<link>http://www.davepcguy.com</link>
	<description>Computers and Technology</description>
	<lastBuildDate>Fri, 10 Sep 2010 15:43:14 +0000</lastBuildDate>
	<language>en</language>
	<sy:updatePeriod>hourly</sy:updatePeriod>
	<sy:updateFrequency>1</sy:updateFrequency>
	<generator>http://wordpress.org/?v=3.0.1</generator>
		<item>
		<title>CSS Vertical Navigation</title>
		<link>http://www.davepcguy.com/archive/css-vertical-navigation/</link>
		<comments>http://www.davepcguy.com/archive/css-vertical-navigation/#comments</comments>
		<pubDate>Thu, 08 Oct 2009 22:30:52 +0000</pubDate>
		<dc:creator>Admin</dc:creator>
				<category><![CDATA[Design]]></category>
		<category><![CDATA[HTML/CSS]]></category>
		<category><![CDATA[Tutorials]]></category>
		<category><![CDATA[css]]></category>
		<category><![CDATA[formatting]]></category>
		<category><![CDATA[lesson]]></category>
		<category><![CDATA[navigation]]></category>
		<category><![CDATA[text]]></category>
		<category><![CDATA[webpage]]></category>

		<guid isPermaLink="false">http://www.davepcguy.com/?p=471</guid>
		<description><![CDATA[CSS Vertical Navigation The List The CSS Sub-Menu Finally! Let&#8217;s check out vertical navigation. This tutorial will cover different tips and tricks on creating the vertical navigation bar. You can read my article on Color Theory and about Color Scheme Designer for more info on picking colors for your navbar. Most navbars, as I&#8217;ve heard,]]></description>
			<content:encoded><![CDATA[<div class="tweetmeme_button" style="float: right; margin-left: 10px;">
			<a href="http://api.tweetmeme.com/share?url=http%3A%2F%2Fwww.davepcguy.com%2Farchive%2Fcss-vertical-navigation%2F"><br />
				<img src="http://api.tweetmeme.com/imagebutton.gif?url=http%3A%2F%2Fwww.davepcguy.com%2Farchive%2Fcss-vertical-navigation%2F&amp;source=clrkmck&amp;style=normal&amp;service_api=clrkmck%3AR_a73f58a91ed3515157df75ab6c37730f&amp;hashtags=css,formatting,lesson,navigation,text,webpage" height="61" width="50" /><br />
			</a>
		</div>
<ul>
<li>
<h1 style="padding:10px"><a href="http://www.davepcguy.com/archive/css-vertical-navigation/">CSS Vertical Navigation</a></h1>
<ul style="text-decoration: none; border: 1px solid black; list-style: none; margin-left: -1em; width: 150px; padding: 3px; display: block">
<li><a href="#list">The List</a></li>
<li><a href="#css">The CSS</a></li>
<li><a href="#sub">Sub-Menu</a></li>
</ul>
</li>
</ul>
<p>Finally! Let&#8217;s check out vertical navigation. This tutorial will cover different tips and tricks on creating the vertical navigation bar. You can read my article on Color Theory and about Color Scheme Designer for more info on picking colors for your navbar. Most navbars, as I&#8217;ve heard, depend on javascript for the more hardcore effects but I&#8217;ll show you how to create some dazzling, amazing navbars WITHOUT the knowledge of javascript. Which is great, because I don&#8217;t know javascript at all.<span id="more-471"></span></p>
<h1><a name="list">The List</a></h1>
<p>First we need to set up the navigation using lists and divs with unique id&#8217;s we&#8217;ll use in the CSS part. This is what it should look like:</p>
<blockquote><p>&lt;div id=&#8221;navdiv&#8221;&gt;<br />
&lt;ul id=&#8221;navlist&#8221;&gt;<br />
&lt;li&gt;&lt;a href=&#8221;link1.html&#8221;&gt;link one&lt;/a&gt;&lt;/li&gt;<br />
&lt;li&gt;&lt;a href=&#8221;link2.html&#8221;&gt;link two&lt;/a&gt;&lt;/li&gt;<br />
&lt;li&gt;&lt;a href=&#8221;link3.html&#8221;&gt;link three&lt;/a&gt;&lt;/li&gt;<br />
&lt;/ul&gt;<br />
&lt;/div&gt;</p></blockquote>
<p>Here we set up a container &#8220;div&#8221; to which you can apply numerous properties. But anyways, we have a nice list set up. Here&#8217;s what the same navbar would look like if you wanted a sub-menu to appear:</p>
<blockquote><p>&lt;div id=&#8221;navcontainer&#8221;&gt;<br />
&lt;ul id=&#8221;navlist&#8221;&gt;<br />
&lt;li&gt;&lt;a href=&#8221;link1.html&#8221;&gt;link one&lt;/a&gt;</p>
<p>&lt;ul id=&#8221;subnavlist&#8221;&gt;&lt;li&gt;&lt;a href=&#8221;link1a.html&#8221;&gt;link one a&lt;/a&gt;&lt;/li&gt;</p>
<p>&lt;li&gt;&lt;a href=&#8221;link1b.html&#8221;&gt;link one b&lt;/a&gt;&lt;/li&gt;</p>
<p>&lt;/ul&gt;</p>
<p>&lt;/li&gt;<br />
&#8230;..<br />
&lt;/ul&gt;<br />
&lt;/div&gt;</p></blockquote>
<p>The whole process can be done without id&#8217;s but if you want to implement this in your website, it may cause some confusion.</p>
<h1><a name="CSS">The CSS</a></h1>
<br />
Let&#8217;s set up the CSS then. First, we&#8217;ll want to define the width of the container:</p>
<blockquote><p>#navdiv {</p>
<p>160px;</p>
<p>}</p></blockquote>
<p>Result so far:</p>
<p><div id="attachment_539" class="wp-caption aligncenter" style="width: 159px"><a href="http://www.davepcguy.com/wp-content/uploads/2009/10/list1.png"><img class="size-full wp-image-539" title="list1" src="http://www.davepcguy.com/wp-content/uploads/2009/10/list1.png" alt="List" width="149" height="126" /></a><p class="wp-caption-text">List</p></div>
<p>Let&#8217;s talk about the navlist and set up the appropriate margins then:</p>
<blockquote><p>#navlist {</p>
<p>margin-left: 0;<br />
padding-left: 0;<br />
list-style-type: none;<br />
font-family: Arial, Helvetica, sans-serif;<br />
border: 1px solid black;</p>
<p>}</p></blockquote>
<p>Result so far:</p>
<div id="attachment_540" class="wp-caption aligncenter" style="width: 178px"><a href="http://www.davepcguy.com/wp-content/uploads/2009/10/list2.png"><img class="size-full wp-image-540" title="list2" src="http://www.davepcguy.com/wp-content/uploads/2009/10/list2.png" alt="List 2" width="168" height="109" /></a><p class="wp-caption-text">List 2</p></div>
<p>I&#8217;ve just basically reset some of the margin and padding values used as a default (it&#8217;s always good to include a general reset sheet at the beginning of the CSS file). I&#8217;ve also removed the bullet points from the side so that it&#8217;s an unordered list without any markings. I&#8217;ve set up the font-family (again, a reset) and put a border around our navigation.</p>
<p>Next, we&#8217;ll set up a couple values for the &#8220;a&#8221; element, that is all the hyperlinks involved will follow the style:</p>
<blockquote><p>#navlist a<br />
{<br />
display: block;<br />
padding: 3px;<br />
background-color: #FFFFFF;<br />
}</p></blockquote>
<p>Result so far:</p>
<div id="attachment_541" class="wp-caption aligncenter" style="width: 188px"><a href="http://www.davepcguy.com/wp-content/uploads/2009/10/list3.png"><img class="size-full wp-image-541" title="list3" src="http://www.davepcguy.com/wp-content/uploads/2009/10/list3.png" alt="List 3" width="178" height="153" /></a><p class="wp-caption-text">List 3</p></div>
<p>We&#8217;ve made it so that not only the WORDS of the hyperlinks will serve as a link but the whole block inside the division will be the hyperlink. It&#8217;s a sort of a nice effect. Check the final version to see what I mean.The padding of 3px is essential so that the navbar won&#8217;t be clumped together.</p>
<p>Next, we&#8217;ll tackle the a:link and a:visited:</p>
<blockquote><p>#navlist a:link, #navlist a:visited<br />
{<br />
color: #0000CC;<br />
text-decoration: none;<br />
}</p></blockquote>
<p>Result so far:</p>
<div id="attachment_542" class="wp-caption aligncenter" style="width: 177px"><a href="http://www.davepcguy.com/wp-content/uploads/2009/10/list4.png"><img class="size-full wp-image-542" title="list4" src="http://www.davepcguy.com/wp-content/uploads/2009/10/list4.png" alt="List 4" width="167" height="140" /></a><p class="wp-caption-text">List 4</p></div>
<p>We used these two pseudo classes and look where it&#8217;s gotten us. The links are no longer underlined (a success!) and they will also not change color once clicked which, I think, is highly desirable in a navbar. One more effect to go and then we&#8217;ll move onto the sub-menu:</p>
<blockquote><p>#navlist a:hover<br />
{<br />
background-color: #369;<br />
color: #fff;</p>
<p>}</p></blockquote>
<p>Result so far:</p>
<p><a href="http://www.davepcguy.com/wp-content/uploads/2009/10/list5.png"><img class="aligncenter size-full wp-image-543" title="list5" src="http://www.davepcguy.com/wp-content/uploads/2009/10/list5.png" alt="list5" width="169" height="137" /></a></p>
<p>Here&#8217;s a nifty effect. When you hover over the link, not only will it show up as a block (defined above) but it will also change color of the background as well as the text. If you delete the sub-menus from the list, you&#8217;ll get a nice clean navigation. If you keep the sub-menu items, you&#8217;ll get the result above.</p>
<h1><a name="sub">Sub-Menu</a></h1>
<p>Sub-menus, yay! Currently, only one sub-menu is supported which sucks but then again, who uses more than one sub-menu? Not me, that&#8217;s for sure. Let&#8217;s focus though. Here&#8217;s initial code concerning sub-menus:</p>
<blockquote><p>#navlist li&gt;ul{<br />
display: none;<br />
position: absolute;<br />
width: 100px;<br />
margin-top: -1.6em;<br />
margin-left: 157px;</p>
<p>}</p></blockquote>
<p>Result so far:</p>
<div id="attachment_544" class="wp-caption aligncenter" style="width: 180px"><a href="http://www.davepcguy.com/wp-content/uploads/2009/10/list6.png"><img class="size-full wp-image-544" title="list6" src="http://www.davepcguy.com/wp-content/uploads/2009/10/list6.png" alt="List 6" width="170" height="85" /></a><p class="wp-caption-text">List 6</p></div>
<p>First of all, this is how your navigation bar will look like without sub-menus. Second, this is what it will look like when the sub-menus are not shown.</p>
<p>Ah, so here we go. By using li&gt;ul, we&#8217;re only defining lists listed under other lists, now that&#8217;s a mouthful. The &#8220;display: none&#8221; makes the sub-menu invisible for the moment. The position is absolute so when placing this on your website, make sure to change the values accordingly. The only part that will need changing is probably &#8220;margin-left&#8221;. If you set a different width for the original list, you&#8217;ll have to adjust for that. Let&#8217;s look at why we need the &#8220;margin-top&#8221; in the negatives. This is what a simple list looks like:</p>
<blockquote>
<ul>
<li>one
<ul>
<li>one A</li>
<li> one B</li>
</ul>
</li>
<li> two</li>
</ul>
</blockquote>
<p>See what happened? The nested list has moved down and right. What we want though, is to have the list right NEXT to its parent list item like this:</p>
<blockquote>
<ul>
<li>one
<ul style="margin-top: -1.4em; margin-left: 40px">
<li>one A</li>
<li> one B</li>
</ul>
</li>
<li> two</li>
</ul>
</blockquote>
<p>The usual value is about -1.4em for margin-top to get the lists lined up but you&#8217;ll have to experiment if you added any padding, margins, and such. Like in the list we&#8217;re making, I had to adjust by putting -1.6 em. For margin-left, The value here is 40px.</p>
<p>Let&#8217;s make the sub-menu appear:</p>
<blockquote><p>#navlist li:hover&gt;ul {<br />
display: block;<br />
}</p></blockquote>
<p>And that&#8217;s it. We&#8217;re finished, this last piece will make the sub-menu appear when the original list is hovered over. There are many ways to re-make this navigation bar to make it prettier but these are the basics. Try experimenting with borders, padding, backgrounds, and such and see what you get.</p>
<p>Final result:</p>
<div id="attachment_545" class="wp-caption aligncenter" style="width: 286px"><a href="http://www.davepcguy.com/wp-content/uploads/2009/10/list7.png"><img class="size-full wp-image-545" title="list7" src="http://www.davepcguy.com/wp-content/uploads/2009/10/list7.png" alt="Final List" width="276" height="90" /></a><p class="wp-caption-text">Final List</p></div>
<p>Here&#8217;s the final code:</p>
<blockquote><p>&lt;head&gt;<br />
&lt;meta http-equiv=&#8221;Content-Type&#8221; content=&#8221;text/html; charset=utf-8&#8243; /&gt;<br />
&lt;title&gt;Untitled Document&lt;/title&gt;<br />
&lt;style type=&#8217;text/css&#8217;&gt;<br />
/* NAVIGATION */<br />
#navcontainer {<br />
width: 160px;<br />
padding: 100px;<br />
}</p>
<p>#navlist<br />
{<br />
margin-left: 0;<br />
padding-left: 0;<br />
list-style-type: none;<br />
font-family: Arial, Helvetica, sans-serif;<br />
border: 1px solid black;</p>
<p>}</p>
<p>#navlist a<br />
{<br />
display: block;<br />
padding: 3px;<br />
background-color: #FFFFFF;<br />
}</p>
<p>#navlist a:link, #navlist a:visited<br />
{<br />
color: #0000CC;<br />
text-decoration: none;<br />
}</p>
<p>#navlist a:hover<br />
{<br />
background-color: #369;<br />
color: #fff;</p>
<p>}</p>
<p>#navlist li&gt;ul{<br />
display: none;<br />
position: absolute;<br />
width: 100px;</p>
<p>margin-top: -1.6em;<br />
margin-left: 158px;</p>
<p>}</p>
<p>#navlist li:hover&gt;ul {<br />
display: block;<br />
}</p>
<p>&lt;/style&gt;<br />
&lt;/head&gt;</p>
<p>&lt;body&gt;<br />
&lt;div id=&#8221;navcontainer&#8221;&gt;&lt;ul id=&#8221;navlist&#8221;&gt;<br />
&lt;li&gt;&lt;a href=&#8221;link1.html&#8221;&gt;link one&lt;/a&gt;<br />
&lt;ul id=&#8221;navlist&#8221;&gt;&lt;li&gt;&lt;a href=&#8221;link1a.html&#8221;&gt;link one A &lt;/a&gt;&lt;/li&gt;<br />
&lt;li&gt;&lt;a href=&#8221;linkoneb.html&#8221;&gt;link one B &lt;/a&gt;&lt;/li&gt;<br />
&lt;/ul&gt;<br />
&lt;li&gt;&lt;a href=&#8221;link2.html&#8221;&gt;link two&lt;/a&gt;&lt;/li&gt;<br />
&lt;li&gt;&lt;a href=&#8221;link3.html&#8221;&gt;link three&lt;/a&gt;&lt;/li&gt;<br />
&lt;/ul&gt;<br />
&lt;/div&gt;<br />
&lt;/body&gt;</p></blockquote>



Share and Enjoy:


	<a rel="nofollow"  target="_blank" href="http://www.printfriendly.com/print?url=http%3A%2F%2Fwww.davepcguy.com%2Farchive%2Fcss-vertical-navigation%2F&amp;partner=sociable" title="Print"><img src="http://www.davepcguy.com/wp-content/plugins/sociable/images/printfriendly.png" title="Print" alt="Print" /></a>
	<a rel="nofollow"  target="_blank" href="http://digg.com/submit?phase=2&amp;url=http%3A%2F%2Fwww.davepcguy.com%2Farchive%2Fcss-vertical-navigation%2F&amp;title=CSS%20Vertical%20Navigation&amp;bodytext=%0D%0A%09%0D%0ACSS%20Vertical%20Navigation%0D%0A%0D%0A%09The%20List%0D%0A%09The%20CSS%0D%0A%09Sub-Menu%0D%0A%0D%0A%0D%0A%0D%0AFinally%21%20Let%27s%20check%20out%20vertical%20navigation.%20This%20tutorial%20will%20cover%20different%20tips%20and%20tricks%20on%20creating%20the%20vertical%20navigation%20bar.%20You%20can%20read%20my%20article%20on%20Color%20Theory%20an" title="Digg"><img src="http://www.davepcguy.com/wp-content/plugins/sociable/images/digg.png" title="Digg" alt="Digg" /></a>
	<a rel="nofollow"  target="_blank" href="http://delicious.com/post?url=http%3A%2F%2Fwww.davepcguy.com%2Farchive%2Fcss-vertical-navigation%2F&amp;title=CSS%20Vertical%20Navigation&amp;notes=%0D%0A%09%0D%0ACSS%20Vertical%20Navigation%0D%0A%0D%0A%09The%20List%0D%0A%09The%20CSS%0D%0A%09Sub-Menu%0D%0A%0D%0A%0D%0A%0D%0AFinally%21%20Let%27s%20check%20out%20vertical%20navigation.%20This%20tutorial%20will%20cover%20different%20tips%20and%20tricks%20on%20creating%20the%20vertical%20navigation%20bar.%20You%20can%20read%20my%20article%20on%20Color%20Theory%20an" title="del.icio.us"><img src="http://www.davepcguy.com/wp-content/plugins/sociable/images/delicious.png" title="del.icio.us" alt="del.icio.us" /></a>
	<a rel="nofollow"  target="_blank" href="http://www.facebook.com/share.php?u=http%3A%2F%2Fwww.davepcguy.com%2Farchive%2Fcss-vertical-navigation%2F&amp;t=CSS%20Vertical%20Navigation" title="Facebook"><img src="http://www.davepcguy.com/wp-content/plugins/sociable/images/facebook.png" title="Facebook" alt="Facebook" /></a>
	<a rel="nofollow"  target="_blank" href="http://www.google.com/bookmarks/mark?op=edit&amp;bkmk=http%3A%2F%2Fwww.davepcguy.com%2Farchive%2Fcss-vertical-navigation%2F&amp;title=CSS%20Vertical%20Navigation&amp;annotation=%0D%0A%09%0D%0ACSS%20Vertical%20Navigation%0D%0A%0D%0A%09The%20List%0D%0A%09The%20CSS%0D%0A%09Sub-Menu%0D%0A%0D%0A%0D%0A%0D%0AFinally%21%20Let%27s%20check%20out%20vertical%20navigation.%20This%20tutorial%20will%20cover%20different%20tips%20and%20tricks%20on%20creating%20the%20vertical%20navigation%20bar.%20You%20can%20read%20my%20article%20on%20Color%20Theory%20an" title="Google Bookmarks"><img src="http://www.davepcguy.com/wp-content/plugins/sociable/images/googlebookmark.png" title="Google Bookmarks" alt="Google Bookmarks" /></a>
	<a rel="nofollow"  target="_blank" href="http://www.linkedin.com/shareArticle?mini=true&amp;url=http%3A%2F%2Fwww.davepcguy.com%2Farchive%2Fcss-vertical-navigation%2F&amp;title=CSS%20Vertical%20Navigation&amp;source=Dave+PC+Guy+Computers+and+Technology&amp;summary=%0D%0A%09%0D%0ACSS%20Vertical%20Navigation%0D%0A%0D%0A%09The%20List%0D%0A%09The%20CSS%0D%0A%09Sub-Menu%0D%0A%0D%0A%0D%0A%0D%0AFinally%21%20Let%27s%20check%20out%20vertical%20navigation.%20This%20tutorial%20will%20cover%20different%20tips%20and%20tricks%20on%20creating%20the%20vertical%20navigation%20bar.%20You%20can%20read%20my%20article%20on%20Color%20Theory%20an" title="LinkedIn"><img src="http://www.davepcguy.com/wp-content/plugins/sociable/images/linkedin.png" title="LinkedIn" alt="LinkedIn" /></a>
	<a rel="nofollow"  target="_blank" href="http://reddit.com/submit?url=http%3A%2F%2Fwww.davepcguy.com%2Farchive%2Fcss-vertical-navigation%2F&amp;title=CSS%20Vertical%20Navigation" title="Reddit"><img src="http://www.davepcguy.com/wp-content/plugins/sociable/images/reddit.png" title="Reddit" alt="Reddit" /></a>
	<a rel="nofollow"  target="_blank" href="http://www.tumblr.com/share?v=3&amp;u=http%3A%2F%2Fwww.davepcguy.com%2Farchive%2Fcss-vertical-navigation%2F&amp;t=CSS%20Vertical%20Navigation&amp;s=%0D%0A%09%0D%0ACSS%20Vertical%20Navigation%0D%0A%0D%0A%09The%20List%0D%0A%09The%20CSS%0D%0A%09Sub-Menu%0D%0A%0D%0A%0D%0A%0D%0AFinally%21%20Let%27s%20check%20out%20vertical%20navigation.%20This%20tutorial%20will%20cover%20different%20tips%20and%20tricks%20on%20creating%20the%20vertical%20navigation%20bar.%20You%20can%20read%20my%20article%20on%20Color%20Theory%20an" title="Tumblr"><img src="http://www.davepcguy.com/wp-content/plugins/sociable/images/tumblr.png" title="Tumblr" alt="Tumblr" /></a>
	<a rel="nofollow"  target="_blank" href="http://twitter.com/home?status=CSS%20Vertical%20Navigation%20-%20http%3A%2F%2Fwww.davepcguy.com%2Farchive%2Fcss-vertical-navigation%2F" title="Twitter"><img src="http://www.davepcguy.com/wp-content/plugins/sociable/images/twitter.png" title="Twitter" alt="Twitter" /></a>
	<a rel="nofollow"  target="_blank" href="mailto:?subject=CSS%20Vertical%20Navigation&amp;body=http%3A%2F%2Fwww.davepcguy.com%2Farchive%2Fcss-vertical-navigation%2F" title="email"><img src="http://www.davepcguy.com/wp-content/plugins/sociable/images/email_link.png" title="email" alt="email" /></a>
	<a rel="nofollow"  target="_blank" href="http://slashdot.org/bookmark.pl?title=CSS%20Vertical%20Navigation&amp;url=http%3A%2F%2Fwww.davepcguy.com%2Farchive%2Fcss-vertical-navigation%2F" title="Slashdot"><img src="http://www.davepcguy.com/wp-content/plugins/sociable/images/slashdot.png" title="Slashdot" alt="Slashdot" /></a>
	<a rel="nofollow"  target="_blank" href="http://www.stumbleupon.com/submit?url=http%3A%2F%2Fwww.davepcguy.com%2Farchive%2Fcss-vertical-navigation%2F&amp;title=CSS%20Vertical%20Navigation" title="StumbleUpon"><img src="http://www.davepcguy.com/wp-content/plugins/sociable/images/stumbleupon.png" title="StumbleUpon" alt="StumbleUpon" /></a>


<br/><br/>]]></content:encoded>
			<wfw:commentRss>http://www.davepcguy.com/archive/css-vertical-navigation/feed/</wfw:commentRss>
		<slash:comments>1</slash:comments>
		</item>
	</channel>
</rss>
