CSS3+HTML5 effects-up and down sliding effect

Source: Internet
Author: User
Tags relative

First look at the effect, move the mouse up to see.

Back Front

1. This example requires the following elements:

A. Outer container box

B. Border of the content device

C. Default display content Front

D. Sliding content back

2. The height of the outer container box is 200px,width 200px;

. box1{
position:relative;
top:100px;
left:100px;
width:200px;
height:200px;
border:1px solid #ccc;
Overflow:hidden;
}

3. The height of the border of the content device is 200%,width for 100%,top-100%;

. border1{
Position:absolute;
Top:-100%;
left:0px;
width:100%;
height:200%;

Transform:translatey (0px);
-webkit-transition:1s all ease;
Transition:1s all ease;
}

4. Need to display 2 elements, height is 50%,width to 100%;

. front1{
width:100%;
height:50%;
Background: #ff0000;
}

. back1{
width:100%;
height:50%;
Background: #00ff00;
}


5. Add mouse to move into effect, the mouse moved in after the content of the device border down 50%, will slide content back display, the original content front sliding hide;


. Box1:hover. border1{
-webkit-transform:translatey (50%);
Transform:translatey (50%);
-webkit-transition:1s all ease;
Transition:1s all ease;
}

6. Page Content


<div class= "Box1" >
<div class= "Border1" >
<div class= "Back1" >back</div>
<div class= "Front1" >front</div>
</div>
</div>


Done.



Contact Us

The content source of this page is from Internet, which doesn't represent Alibaba Cloud's opinion; products and services mentioned on that page don't have any relationship with Alibaba Cloud. If the content of the page makes you feel confusing, please write us an email, we will handle the problem within 5 days after receiving your email.

If you find any instances of plagiarism from the community, please send an email to: info-contact@alibabacloud.com and provide relevant evidence. A staff member will contact you within 5 working days.

A Free Trial That Lets You Build Big!

Start building with 50+ products and up to 12 months usage for Elastic Compute Service

  • Sales Support

    1 on 1 presale consultation

  • After-Sales Support

    24/7 Technical Support 6 Free Tickets per Quarter Faster Response

  • Alibaba Cloud offers highly flexible support services tailored to meet your exact needs.