Snippets

Simple CSS horizontal nav with fading links

June 25, 2017

menu hover

Simple CSS horizontal nav with fading links
<ul class="nav"> <li><a href="">Home</a></li> <li><a href="">About us</a></li> <li><a href="">Products</a></li> <li><a href="">Contact us</a></li> </ul> .nav { list-style: none; margin: 0 auto; } .nav li { float: left; } .nav > li a { display: block; padding: 12px 18px; text-decoration: none; color: #999; border-bottom: 1px solid #eee; transition: all ease .5s; background: #fff; } .nav:hover > li a { opacity: .5; transition: all ease .5s; } .nav > li:hover a { opacity: 1; color: #000; border-color: #000; }

Related Content

Easy Way to Fix Anchor Links Scrolling Too Far

Stories

Easy Way to Fix Anchor Links Scrolling Too Far

Fixed navbar is a very popular way of displaying navigation when a page is scrolled, but you could run into a small detail that needs to be addressed.

How to Avoid Page Flickering When Scrollbars are Dynamically Shown or Hidden?

Stories

How to Avoid Page Flickering When Scrollbars are Dynamically Shown or Hidden?

There are certain cases when you want to dynamically manipulate the page height which will result in flickering.

Changing the Mouse Cursor in CSS With the cursor Property

Stories

Changing the Mouse Cursor in CSS With the cursor Property

Using CSS to change the cursor on your website is a great way to add a little bit of personality to your site.