Home > Web Front-end > CSS Tutorial > CSS3 Transition smooth transition menu bar implementation

CSS3 Transition smooth transition menu bar implementation

php中世界最好的语言
Release: 2018-03-21 13:25:51
Original
2544 people have browsed it

This time I will bring you the implementation of CSS3's Transition smooth transition menu bar. What are the precautions for implementing Transition smooth transition menu bar? The following is a practical case, let's take a look.

The three major properties of CSS3 animation (Transform, Transition, Animation) are introduced below. The Transition property. The transition property is a shorthand property with four properties: transition-property, transition-duration, transition-timing-function, and transition-delay.

Syntax

transition: property duration timing-function delay;
Copy after login
Attributes:

##Valuetransition-propertytransition-durationtransition-timing-functiontransition-delayA case is given below
Description
Specify the name of the CSS property, transition effect
The transition effect needs to specify how many seconds or milliseconds it takes to complete
Specify the speed curve of the transition effect
When defining the transition effect at the beginning

First look at the rendering:

CSS3 Transition smooth transition menu bar implementationPrinciple illustration:

CSS3 Transition smooth transition menu bar implementationWhen the mouse moves into the menu list, add a hover style. That is, set the top value of p.wrap to a negative value. Then use the transition attribute to make it a smooth transition.

Complete demo

<!--html-->
<style>
 .menu{
        margin: 100px auto;
    }
    .menu ul li{
        float:left;
        width: 50px;
        height: 25px;
        background-color: #2aabd2;
        margin-right: 5px;
        line-height: 25px;
        position: relative;
        overflow: hidden;
    }
    .menu ul li a{
        display: block;
        height:25px;
        width: 50px;
        text-align: center;
        line-height: 25px;
        color: white;
    }
    .menu ul li .awrap{
        position: absolute;
        top:0;
        left: 0;
    }
    .menu ul li .awrap:hover{
        transition: all .3s ease-in;
        top:-25px;
    }
</style>
<p>
    </p>
Copy after login
            
  •             

                                     菜单             

            
  •         
  •             

                                     菜单             

            
  •         
  •             

                                     菜单             

            
  •         
  •             

                                     菜单             

            
  •         
  •             

                                     菜单             

            
  •     

Note: The icon uses the font icon Font Awesome. If you need to know more, you can search Font Awesome

I believe you have read the case in this article You have mastered the method. For more exciting information, please pay attention to other related articles on the php Chinese website!

Recommended reading:

Detailed explanation of the use of pointer-events in css3


Detailed explanation of the use of focus-within


CSS3 to make seamless carousel ads

The above is the detailed content of CSS3 Transition smooth transition menu bar implementation. For more information, please follow other related articles on the PHP Chinese website!

Related labels:
source:php.cn
Statement of this Website
The content of this article is voluntarily contributed by netizens, and the copyright belongs to the original author. This site does not assume corresponding legal responsibility. If you find any content suspected of plagiarism or infringement, please contact admin@php.cn
Popular Tutorials
More>
Latest Downloads
More>
Web Effects
Website Source Code
Website Materials
Front End Template