nav
私はいくつかのシンプルなものを持っていULs
ますLIs
。しかし、サブメニューを作成するためLIs
に別のものを持っている人もいUL
ますが、サブメニューは右側に向かっています。
このフィドルを参照してください。
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;
}
LIs
二重にネストされたものをメインメニューの左側に揃えるにはどうすればよいですか?
私がはっきりしていることを願っています。
前もって感謝します。