CSS3 learning notes (4)-slide up and down buttons, css3 learning notes

Source: Internet
Author: User

CSS3 learning notes (4)-slide up and down buttons, css3 learning notes

Well, I haven't made any progress recently. Actually, I'm just being lazy. I 've been so cool at code these days. I 've been designing and dizzy,

Next let's take a look at a button that I wrote previously, sliding up and down to expand the effect:

This type of effect is often seen in some website page download buttons. When you hover the mouse over the Download button, it will remind you whether you have registered, or click the logon tips ~~~~~

 

 

I. Page subject layout

<! DOCTYPE html> 

The layout is simple ~~~~~

 

 

Ii. CSS style (mainly CSS3)

Let's talk about the principle of Animation:

(1) Layout first. I will sort out three divs in parallel, for example:

(2) place the two child buttons of sild_top and sild_bottom below the button of the tag, and use the z-index attribute in positioning.

(3) then, the two child buttons of sild_top and sild_bottom are moved to the front and bottom of the tag button.

(4) set an animation for the two child buttons of sild_top and sild_bottom.

. Both_sild_menu {text-align: center; width: 300px ;}. both_sild_menu. sild_top {text-decoration: none; padding: 10px; background-color: # 6c987e; border-radius: 10px 10px 0 0; /* place it at the bottom of both_sild_menu a and hide it */transform: translate (0, 40px); opacity: 0; /* put it at the bottom and make it transparent to 0. */position: relative; z-index: 1;} is not displayed ;}. both_sild_menu a {display: block; text-decoration: none; padding: 10px; background-color: #7 eedaa; position: relative; z-index: 2; /* place it at the top */}. both_sild_menu. sild_bottom {text-decoration: none; padding: 10px; background-color: # 6c987e; border-radius: 0 0 10px 10px; /* place it at the bottom of both_sild_menu a and hide it */opacity: 0; transform: translate (0,-40px); position: relative; z-index: 1 ;}. both_sild_menu. sild_top ,. both_sild_menu. sild_bottom {/* set the animation attribute for the two divs */transition: all 0.2 s bytes-in-out 0 s;-moz-transition: all 0.2 s records-in-out 0 s;-ms-transition: all 0.2 s records-in-out 0 s;-o-transition: all 0.2 s bytes-in-out 0 s;-webkit-transition: all 0.2 s bytes-in-out 0 s ;} /* The div animation effect setting named sild_top starts */. both_sild_menu: hover. sild_top {/* When the mouse is hovering over the frame, the transparency of the div named sild_top is changed to 1 */opacity: 1 ;}. both_sild_menu: hover. sild_top {/* move the div named sild_top from the initial Y axis 40px to the 0px position on the Y axis */transform: translate (0, 0);-moz-transform: translate ();-o-transform: translate ();-ms-transform: translate ();-webkit-transform: translate );} /* The div animation effect set "sild_top" ends. * // * The div animation effect set "sild_bottom" starts */. both_sild_menu: hover. sild_bottom {opacity: 1 ;}. both_sild_menu: hover. sild_bottom {transform: translate (0, 0);-moz-transform: translate (0, 0);-o-transform: translate (0, 0);-ms-transform: translate (0, 0 ); -webkit-transform: translate ();}/* ends the div animation effect setting with the name of sild_bottom */

I have already made it very clear about the principle. It should be easy to see how it works with the above program ~~~~~

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.