A collection of hover effects for menus, using CSS3 transitions.
A Pen by Callum Williams on CodePen.
<nav id="nav-1"> | |
<a class="link-1" href="#">Home</a> | |
<a class="link-1" href="#">About</a> | |
<a class="link-1" href="#">Contact</a> | |
<a class="link-1" href="#">Shop</a> | |
</nav> | |
<nav id="nav-2"> | |
<a class="link-2" href="#">Home</a> | |
<a class="link-2" href="#">About</a> | |
<a class="link-2" href="#">Contact</a> | |
<a class="link-2" href="#">Shop</a> | |
</nav> |
@import url(http://fonts.googleapis.com/css?family=Raleway); | |
body { | |
margin: 0px; | |
} | |
nav { | |
margin-top: 50px; | |
padding: 24px; | |
text-align: center; | |
font-family: Raleway; | |
box-shadow: 2px 2px 8px -1px #000000; | |
} | |
#nav-1 { | |
background: #3fa46a; | |
} | |
#nav-2 { | |
background: #5175C0; | |
} | |
.link-1 { | |
transition: 0.3s ease; | |
background: #3fa46a; | |
color: #ffffff; | |
font-size: 20px; | |
text-decoration: none; | |
border-top: 4px solid #3fa46a; | |
border-bottom: 4px solid #3fa46a; | |
padding: 20px 0; | |
margin: 0 20px; | |
} | |
.link-1:hover { | |
border-top: 4px solid #ffffff; | |
border-bottom: 4px solid #ffffff; | |
padding: 6px 0; | |
} | |
.link-2 { | |
transition: 0.6s; | |
color: #ffffff; | |
font-size: 20px; | |
text-decoration: none; | |
border-right: 2px dotted transparent; | |
padding: 30px 10px 0 10px; | |
margin: 0 10px; | |
} | |
.link-2:hover { | |
border-right: 2px dotted #ffffff; | |
padding-bottom: 24px; | |
} |