CSS3 implementation of the mouse suspension door closing Effect code example

Source: Internet
Author: User

CSS3 implementation of the mouse suspension door closing Effect code example:
This section shares a code example that uses the CSS3 simulation to achieve a simple open door closing effect.
The code example is as follows:

<!DOCTYPE HTML><HTML> <Head> <MetaCharSet= "Utf-8"> <Metaname= "Author"content= "http://www.softwhy.com/" /> <title>Ant Tribe</title><style>. Door{position:relative;width:400px;Height:300px;Overflow:Hidden;Border:2px solid #000;background:#000;}. Door:before,.door:after{content:"';position:Absolute; Left:0;width:0;Height:0;Overflow:Hidden;Border-color:#000 Transparent Transparent transparent;Border-style:Solid;Border-width:0 200px;Z-index:2;transition:All . 8s Ease;}. Door:before{Top:0;}. Door:after{Bottom:0;Border-color:transparent transparent #000 transparent;}. Door:hover:before,.door:hover:after{Border-width:40px 200px;}. Door-left,. Door-right{position:relative;float: Left;width:50%;Height:100%;background:#f00;box-sizing:Border-box;transition:All . 5s Ease;}. Door-left{Border-right:2px solid #000;-webkit-transform-origin:0 0; }. Door-left:before,.door-right:before{content:"';position:Absolute;width:10px;Height:10px;Top:50%;Margin-top:-5px;Border-radius:50%;background:#000; }. Door-left:before{ Right:5px;}. Door-right:before{ Left:5px;}. Door-right{Border-left:2px solid #000;-webkit-transform-origin:100% 0; }. Door:hover. Door-left{-webkit-transform:Rotatey ( -90deg);transition:All . 8s Ease-out; }. Door:hover. Door-right{-webkit-transform:Rotatey (90deg);transition:All . 8s Ease-out; }</style></Head><Body><Divclass= "Door">  <Divclass= "Door-left"></Div>  <Divclass= "Door-right"></Div></Div></Body></HTML>

The above code implements our requirements, the code does not need to introduce too much, just need to understand the principle of the various properties can be.
Related reading:
(1). The Border-color property can be found in the CSS3 border-color usage section.
(2). Transition can be found in the CSS3 transition attribute section.
(3).: Before can refer to the pseudo-object selector before/e::before section of CSS .
(4). Border-radius can refer to the section CSS3 achieving rounded corners .

The original address is: http://www.softwhy.com/forum.php?mod=viewthread&tid=18180

For more information, refer to: http://www.softwhy.com/divcss/

CSS3 implementation of the mouse suspension door closing Effect code example

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.