Reputation: 10179
I have a simple nav
with some ULs
and LIs
. But in some LIs
I have another UL
to create a sub menu but the submenu is just going towards the right side.
See this fiddle.
HTML:
<header>
<h1 style="float: left; margin-top: 2%;"> Naughty Mama.</h1>
<nav>
<ul>
<li><a href="profile.php">My Profile</a>
</li>
<li><a href="inbox.php">Inbox</a>
</li>
<li> <a href="notifications.php">Notifications</a>
<ul>
<li>Notification 1</li>
<li>Notification 2</li>
<li>Notification 3</li>
</ul>
</li>
</ul>
</nav>
</header>
CSS:
header {
background-color: #ddd;
}
nav {
float: right;
margin-right: 5%;
margin-top: 2%;
}
nav ul li {
display: inline-block;
background-color: #eee;
vertical-align: top;
}
nav ul li a {
color: #fff;
text-decoration: none;
display: block;
padding: 15px;
}
nav ul li a:hover {
color: #000;
background: #aaa;
}
nav ul li ul li {
display: block;
}
How can I align those double nested LIs
to left side of the main menu?
Hope I am clear.
Thanks in advance.
Upvotes: 0
Views: 268