CSS3 achieves flippable hover effect

CSS3 achieves flippable hover effect

CSS3 implements a flippable hover effect. The specific code is as follows:

1.css

/*Basic style*/  
html {  
    font-family: sans-serif;  
    -ms-text-size-adjust: 100%;  
    -webkit-text-size-adjust: 100%;  
}  
body {  
    margin: 0 auto;  
    text-align: center;  
    background-color: #FFFFCC;  
}  
ul {  
    list-style: none;  
    float: left;  
    margin: 0;  
    padding: 0;  
}  
a {  
    cursor: pointer;  
}  
div {  
    display: inline-block;  
    margin: 40px;  
}  
ul li {  
    width: 200px;  
    height: 40px;  
    line-height: 40px;  
    text-align: center;  
    margin: 10px;  
    background-color: #747474;  
    border-radius: 4px;  
    color: white;  
}  
dis-block{  
    display: block;  
}  
/*#nav1 mouse hover effect flips back and forth*/  
#nav1 ul li {  
    transform-style: preserve-3d;  
    -webkit-transform-style: preserve-3d;  
    -ms-transform-style: preserve-3d;  
    -moz-transform-style: preserve-3d;  
    transition: 0.5s;  
    -webkit-transition: 0.5s;  
    -ms-transition: 0.5s;  
    -moz-transition: 0.5s;  
}  
#nav1 ul li:hover {  
    transform: translateZ(30px) rotateX(360deg) scale(1.1);  
    -webkit-transform: translateZ(30px) rotateX(360deg) scale(1.1);  
    -ms-transform: translateZ(30px) rotateX(360deg) scale(1.1);  
    -moz-transform: translateZ(30px) rotateX(360deg) scale(1.1);  
}  
/*#nav2 mouse hover effect floats up*/  
#nav2 ul li {  
    transform-style: preserve-3d;  
    -webkit-transform-style: preserve-3d;  
    -ms-transform-style: preserve-3d;  
    -moz-transform-style: preserve-3d;  
    transition: 0.5s;  
    -webkit-transition: 0.5s;  
    -ms-transition: 0.5s;  
    -moz-transition: 0.5s;  
}  
#nav2 ul li:hover {  
    transform: translateZ(30px) scale(1.1);  
    -webkit-transform: translateZ(30px) scale(1.1);  
    -ms-transform: translateZ(30px) scale(1.1);  
    -moz-transform: translateZ(30px) scale(1.1);  
}  
/*#nav4 mouse hover effect floats down*/  
#nav4 ul li {  
    transform-style: preserve-3d;  
    -webkit-transform-style: preserve-3d;  
    -ms-transform-style: preserve-3d;  
    -moz-transform-style: preserve-3d;  
    transition: 0.5s;  
    -webkit-transition: 0.5s;  
    -ms-transition: 0.5s;  
    -moz-transition: 0.5s;  
}  
#nav4 ul li:hover {  
    transform: translateZ(30px) scale(0.9);  
    -webkit-transform: translateZ(30px) scale(0.9);  
    -ms-transform: translateZ(30px) scale(0.9);  
    -moz-transform: translateZ(30px) scale(0.9);  
}  
/*#nav3 mouse hover effect flips left and right*/  
#nav3 ul li {  
    transform-style: preserve-3d;  
    -webkit-transform-style: preserve-3d;  
    -ms-transform-style: preserve-3d;  
    -moz-transform-style: preserve-3d;  
    transition: 0.5s;  
    -webkit-transition: 0.5s;  
    -ms-transition: 0.5s;  
    -moz-transition: 0.5s;  
}  
#nav3 ul li:hover {  
    transform: translateZ(30px) rotateY(360deg) scale(1.1);  
    -webkit-transform: translateZ(30px) rotateY(360deg) scale(1.1);  
    -ms-transform: translateZ(30px) rotateY(360deg) scale(1.1);  
    -moz-transform: translateZ(30px) rotateY(360deg) scale(1.1);  
}  
/*button1 hover effect*/  
btn1 {  
    background-color: #1AAB8A;  
    color: white;  
    font-size: 18px;  
    height: 60px;  
    width: 150px;  
    border: 0;  
    transition: 800ms ease all;  
    outline: none;  
    position: relative;  
}  
btn1:hover {  
    background: #fff;  
    color: #1AAB8A;  
}  
btn1:before, .btn1:after {  
    content: '';  
    position: absolute;  
    height: 2px;  
    width: 0;  
    background: #1AAB8A;  
    transition: 400ms ease all;  
}  
btn1:before {  
    right: 0;  
    top: 0;  
}  
btn1:after {  
    left: 0;  
    bottom: 0;  
}  
btn1:hover:before, .btn1:hover:after {  
    width: 100%;  
    transition: 800ms ease all;  
}

2.html

<div id="nav1">  
            <p>Flip front and back</p>  
            <ul>  
                <li>  
                    <a>home</a>  
                </li>  
                <li>  
                    <a>js</a>  
                </li>  
                <li>  
                    <a>jquery</a>  
                </li>  
                <li>  
                    <a>div+css</a>  
                </li>  
                <li>  
                    <a>css3</a>  
                </li>  
            </ul>  
        </div>  
        <div id="nav2">  
            <p>Floating</p>  
            <ul>  
                <li>  
                    <a>home</a>  
                </li>  
                <li>  
                    <a>js</a>  
                </li>  
                <li>  
                    <a>jquery</a>  
                </li>  
                <li>  
                    <a>div+css</a>  
                </li>  
                <li>  
                    <a>css3</a>  
                </li>  
            </ul>  
        </div>  
        <div id="nav4">  
            <p>Floating down</p>  
            <ul>  
                <li>  
                    <a>home</a>  
                </li>  
                <li>  
                    <a>js</a>  
                </li>  
                <li>  
                    <a>jquery</a>  
                </li>  
                <li>  
                    <a>div+css</a>  
                </li>  
                <li>  
                    <a>css3</a>  
                </li>  
            </ul>  
        </div>  
        <div id="nav3">  
            <p>Flip left and right</p>  
            <ul>  
                <li>  
                    <a>home</a>  
                </li>  
                <li>  
                    <a>js</a>  
                </li>  
                <li>  
                    <a>jquery</a>  
                </li>  
                <li>  
                    <a>div+css</a>  
                </li>  
                <li>  
                    <a>css3</a>  
                </li>  
            </ul>  
        </div>  
        <div class="dis-block">  
            <p>Button hover effect</p>  
            <button class="btn1" type="button">hover!</button>  
        </div>

Effect:



Summarize

The above is the CSS3 flippable hover effect that I introduced to you. I hope it will be helpful to you. If you have any questions, please leave me a message and I will reply to you in time. I would also like to thank everyone for their support of the 123WORDPRESS.COM website!

<<:  Use of Docker UI, a Docker visualization management tool

>>:  Vue 2.0 Basics in Detail

Recommend

PHP scheduled backup MySQL and mysqldump syntax parameters detailed

First, let's introduce several common operati...

Briefly understand the MYSQL database optimization stage

introduction Have you ever encountered a situatio...

Use of Linux gzip command

1. Command Introduction The gzip (GNU zip) comman...

Installing Windows Server 2008 operating system on a virtual machine

This article introduces the installation of Windo...

HTML table tag tutorial (32): cell horizontal alignment attribute ALIGN

In the horizontal direction, you can set the cell...

Detailed explanation of the principle of creating tomcat in Eclipse

When creating a tomcat server on a local eclipse,...

html opens a new window with a hyperlink and can control window properties

1. The window size opened by the HTML hyperlink C...

js to achieve drag and drop sorting details

Table of contents 1. Introduction 2. Implementati...

MySQL Server IO 100% Analysis and Optimization Solution

Preface During the stress test, if the most direc...