JSFiddle - React, Tailwind, and code Playground
HTML
<nav class="container">
<ul>
<li><a href="http://localhost/scotthlacey/index.php/home" title="My Home Page">Home</a>
</li>
<li><a href="http://localhost/scotthlacey/index.php/blog" title="My Blog">Blog</a>
</li>
<li><a href="http://localhost/scotthlacey/index.php/portfolio" title="My Portfolio">Portfolio</a>
<ul>
<li><a href="http://localhost/scotthlacey/index.php/portfolio/gallery" title="Photography Gallery">Photography Gallery</a>
</li>
<li><a href="http://localhost/scotthlacey/index.php/portfolio/web-projects" title="Web Projects">Web Projects</a>
</li>
</ul>
</li>
<li><a href="http://localhost/scotthlacey/index.php/services" title="My Services">Services</a>
</li>
<li><a href="http://localhost/scotthlacey/index.php/resume" title="My Resume">Resume</a>
</li>
<li><a href="http://localhost/scotthlacey/index.php/about" title="About Me">About</a>
</li>
<li><a href="http://localhost/scotthlacey/index.php/contact" title="Contact Me">Contact</a>
</li>
</ul>
</nav>
CSS
nav {
background-image: url(../img/themeSprite.gif);
background-position: 0px -153px;
margin: 0px;
padding: 0px;
height: 52px;
border: 1px solid #666;
}
nav > ul {
padding: 0px;
list-style: none;
margin-left: -8px;
}
nav > ul > li {
float: left;
display: inline;
border-left: 1px solid #999;
border-right: 1px solid #111;
height: 52px;
box-shadow: 15px 0 15px -2px rgba(0, 0, 0, .2);
}
nav > ul > li:first {
border-left-width: 0;
}
nav > ul > li > a {
display: block;
margin: 0px;
border-bottom: 0;
color: #333;
height: 52px;
padding: 15px 25px 10px 25px;
font-size: 1.25em;
}
nav > ul > li > a:hover {
background: #66cc00;
}
nav > ul > li > ul {
display: none;
list-style: none;
margin: 0px;
padding: 0px;
position: absolute;
z-index: 2;
}
nav > ul > li > ul > li {
float: none;
}
nav > ul > li > ul > li > a {
background: #333;
border-width: 0px 1px 1px;
border-style: solid;
border-color: #666;
display: block;
padding: 10px 20px;
color: #999;
text-decoration: none;
}
nav > ul > li > ul > li > a:hover {
background: #666;
color: #999;
}
JavaScript
$(document).ready(function () {
$('nav ul li:has(ul)').each(function () {
var listItem = $(this);
$(this).find('> a').each(function () {
var aTag = $(this);
aTag.append('<img src="{img_url}/caret.png" width="8" height="8">');
aTag.on('mouseover', function () {
listItem.find('ul').each(function () {
$(this).css('display', 'block');
});
})
.on('mouseout', function () {
listItem.find('ul').each(function () {
$(this).css('display', 'none');
});
});
});
});
});