By adding a hover effect to items in my menu, I was able to create a subtle underline effect using border-bottom: 2px;
. Surprisingly, when hovering over the menu item, the parent element (the header) also expands by 2px
.
This is my HTML code:
<div class="header">
<nav class="navigation_menu">
<ul class="navigation_ul">
<a href="#"><li>Lorum</li></a>
<a href="#"><li>Ipsum</li></a>
<a href="#"><li>Lorpsum</li></a>
<a href="#"><li>Ipum</li></a>
<a href="#"><li>Nadoa</li></a>
</ul>
</nav>
</div>
This is my CSS code:
body {
background:f5f5f5;
margin: 0px;
padding: 0px;
font-family: roboto;
}
/** Text Style **/
a {
text-decoration: none;
color: inherit;
}
/** Header Style **/
.header {
background: #607d8b;
margin: 0px;
padding: 10px;
padding-bottom: 50px;
color: white;
}
/** Navigation Menu Style **/
.navigation_menu ul {
margin: 0px;
padding: 0px;
overflow: hidden;
}
.navigation_menu li {
font-size:18px;
}
.navigation_menu li:hover {
border-bottom: 2px solid white;
}
.navigation_menu ul li {
display: inline-block;
padding: 0px 0px;
}
Check out the live demo here: http://codepen.io/anon/pen/rVjJqW
I'm looking forward to any insights or solutions you might have! Thank you in advance!