<div class="wrapper">
    <h1>Hyperlink :hover CSS Animations</h1>
    <ol>
        <li>
            <div class="effect-one"><a>Underline - Inside out</a></div>
        </li>
        <li>
            <div class="effect-two"><a>Underline - Right to Left</a></div>
        </li>
        <li>
            <div class="effect-three"><a>Underline - Right to Left</a></div>
        </li>
        <li>
            <div class="effect-four"><a>Underline - Bounce down</a></div>
        </li>
        <li>
            <div class="effect-five"><a>Background color - Right to Left</a></div>
        </li>
        <li>
            <div class="effect-six"><a>Background color - Left to Right</a></div>
        </li>
        <li>
            <div class="effect-seven"><a>Background color - Bottom to Top</a></div>
        </li>
        <li>
            <div class="effect-eight"><a>Background color - Top to Bottom</a></div>
        </li>
    </ol>
</div>
/* Demo styles */
@import url(https://fonts.googleapis.com/css?family=Open+Sans:400,300,600,700);
$mainColor: #21242C;
body {
	font-family: 'Open Sans', sans-serif;
	background: $mainColor;
	color: white;
	font-size: 20px;
	padding: 0;
}
a {
	cursor: pointer;
	text-decoration: none;
}
ol, li {
	margin: 0;
	padding: 0;
}
li {
    padding: 12px;
}
.wrapper {
	width: 100%;
	max-width: 400px;
	margin: 0 auto 0 auto;
}

/**
 * ANIMATIONS CSS ---------------------------------
 */

// Animation 1
// Underline - Inside Out
.effect-one > a {
	position: relative;
	&:before {
		content: "";
		position: absolute;
		width: 100%;
		height: 2px;
		bottom: 0;
		margin: -5px 0;
		background-color: white;
		visibility: hidden;
		transform: scaleX(0);
		transition: all 0.4s ease-in-out 0s;
	}
	&:hover:before {
		visibility: visible;
		transform: scaleX(1);
	}
}

// Animation 2
// Underline - Right to Left
.effect-two > a {
	display: inline-block;
	position: relative;
	&:after {
		content: "";
		display: block;
		position: absolute;
		width: 0;
		bottom: 0;
		height: 2px;
		margin: -5px 0;
		right: 0;
		background-color: white;
		transition: all 0.4s ease-in 0s;
	}
	&:hover:after {
		width: 100%;
	}
}

// Animation 3
// Underline - Left to Right
.effect-three > a {
	display: inline-block;
	position: relative;
	&:after {
		content: "";
		display: block;
		position: absolute;
		width: 0;
		bottom: 0;
		height: 2px;
		margin: -5px 0;
		left: 0;
		background-color: white;
		transition: all 0.4s ease-in 0s;
	}
	&:hover:after {
		width: 100%;
	}
}

// Animation 4
// Background color - Right to Left
.effect-four > a {
	padding: 0 0 4px 0;
	border-bottom: 2px solid $mainColor;
	transition: 0.3s ease;
	&:hover{
		padding: 0 0 6px 0;
		border-color: white;
	}
}

// Animation 5
// Background color - Left to Right
.effect-five > a {
	padding: 0 5px;
	box-shadow: inset 0 0 0 0 white;
	transition: all 0.4s ease-in-out 0s;
	&:hover{
		box-shadow: inset -300px 0 0 0 white;
		color: $mainColor;
	}
}

// Animation 6
// Background color - Left to Right
.effect-six > a {
	padding: 0 5px;
	box-shadow: inset 0 0 0 0 white;
	transition: all 0.4s ease-in-out 0s;
	&:hover{
		box-shadow: inset 300px 0 0 0 white;
		color: $mainColor;
	}
}

// Animation 7
// Background color - Bottom to Top
.effect-seven > a {
	padding: 0 5px;
	box-shadow: inset 0 0 0 0 white;
	transition: all 0.5s ease-in-out 0s;
	&:hover{
		box-shadow: inset 0 -300px 0 0 white;
		color: $mainColor;
	}
}

// Animation 8
// Background color - Top to Bottom
.effect-eight > a {
	padding: 0 5px;
	box-shadow: inset 0 0 0 0 white;
	transition: all 0.5s ease-in-out 0s;
	&:hover{
		box-shadow: inset 0 300px 0 0 white;
		color: $mainColor;
	}
}
View Compiled
Run Pen

External CSS

This Pen doesn't use any external CSS resources.

External JavaScript

This Pen doesn't use any external JavaScript resources.