HTML5 and CSS3 tutorial: Create Spin Text on Mouse Hover

Have you seen website text flip over? You hover your mouse over the text and the text flips.

Sounds difficult? Thanks to the CSS, this effect is easy to achieve.

To create a flip animation with HTML, you need to create two files:

  1. SpinText.html
  2. spin.css

HTML5 and CSS3 tutorial: Create Spin Text on Mouse Hover

After that step you have to paste HTML and CSS codes on their respective Files.

SpinText.html

<!DOCTYPE html>

<html>

<head>

<title>Spin Text</title>

<linkrel="stylesheet"href= "spin.css">

</head>

<body>

<ul>

<li>C</li>

<li>O</li>

<li>R</li>

<li>N</li>

<li>E</li>

<li>R</li>

<li>S</li>

<li>3</li>

<li>6</li>

<li>0</li>

</ul> </body> </html>

spin.css

body{

background: #000;

margin: 0;

padding: 0;

}

ul{

padding: 50px;

margin: 0;

border: 10pxsolid#fff;

display: inline-block;

position: absolute;

top: 50%;

left: 50%;

transform: translateY(-50%) translateX(-50%);

}

ul li{

list-style: none;

color: #fff;

float: left;

font-size: 5em;

font-family: Arial, Helvetica, sans-serif;

transition: .9s;

}

ul:hover li{

transform: rotateY(360deg);

}

ul:hover li:nth-child(1){

transition-delay: .9s;

}

ul:hover li:nth-child(2){

transition-delay: .6s;

}

ul:hover li:nth-child(3){

transition-delay: .3s;

}

After writing this HTML and CSS code when you will run it. This will be the output you will obtained.

Advertisements

Leave a Reply

Fill in your details below or click an icon to log in:

WordPress.com Logo

You are commenting using your WordPress.com account. Log Out /  Change )

Google photo

You are commenting using your Google account. Log Out /  Change )

Twitter picture

You are commenting using your Twitter account. Log Out /  Change )

Facebook photo

You are commenting using your Facebook account. Log Out /  Change )

Connecting to %s

This site uses Akismet to reduce spam. Learn how your comment data is processed.