CSS 3 implements the mouse-over-button special effect and css3 button special effect.

Source: Internet
Author: User

CSS 3 implements the mouse-over-button special effect and css3 button special effect.

Today, we will bring another special css-implemented mouse-over-button effect to all netizens. At the beginning of the button, the border is a closed button. When the mouse goes through the button, the animation changes to a closed border. As follows:

 

Download Online Preview source code

 

Let's take a look at the implementation code:

Html code:

<body>    <a target="_blank" class="btn-edge" href="http://www.w2bc.com/shili">Hover Me</a></body>

Css code:

*, *:before, *:after        {            margin: 0;            padding: 0;            -webkit-box-sizing: border-box;            -moz-box-sizing: border-box;            box-sizing: border-box;        }                body        {            padding-top: 10%;            text-align: center;            overflow-x: hidden;        }                .btn-edge        {            position: relative;            display: inline-block;            padding: 1rem 2rem;            font-family: 'Titillium Web' , sans-serif;            font-weight: 700;            text-decoration: none;            font-size: 3rem;            color: #333;            background-image: -webkit-gradient(linear, left top, left bottom, from(#333), to(#333)), -webkit-gradient(linear, left top, left bottom, from(#333), to(#333)), -webkit-gradient(linear, left top, left bottom, from(#333), to(#333)), -webkit-gradient(linear, left top, left bottom, from(#333), to(#333)), -webkit-gradient(linear, left top, left bottom, from(#333), to(#333)), -webkit-gradient(linear, left top, left bottom, from(#333), to(#333)), -webkit-gradient(linear, left top, left bottom, from(#333), to(#333)), -webkit-gradient(linear, left top, left bottom, from(#333), to(#333));            background-image: -webkit-linear-gradient(#333, #333), -webkit-linear-gradient(#333, #333), -webkit-linear-gradient(#333, #333), -webkit-linear-gradient(#333, #333), -webkit-linear-gradient(#333, #333), -webkit-linear-gradient(#333, #333), -webkit-linear-gradient(#333, #333), -webkit-linear-gradient(#333, #333);            background-image: linear-gradient(#333, #333), linear-gradient(#333, #333), linear-gradient(#333, #333), linear-gradient(#333, #333), linear-gradient(#333, #333), linear-gradient(#333, #333), linear-gradient(#333, #333), linear-gradient(#333, #333);            background-repeat: no-repeat;            -webkit-background-size: 2rem 5px, 2rem 5px, 2rem 5px, 2rem 5px, 5px 2rem, 5px 2rem, 5px 2rem, 5px 2rem;            background-size: 2rem 5px, 2rem 5px, 2rem 5px, 2rem 5px, 5px 2rem, 5px 2rem, 5px 2rem, 5px 2rem;            background-position: 0 0, 100% 0, 0 100%, 100% 100%;            -webkit-box-shadow: inset 0 0 0 5px rgba(255, 99, 71, 0);            box-shadow: inset 0 0 0 5px rgba(255, 99, 71, 0);            -webkit-transition: background-size 1s .4s, -webkit-box-shadow .4s, color .4s;            transition: background-size 1s .4s, box-shadow .4s, color .4s;            -webkit-transform: translateZ(0);            transform: translateZ(0);        }        .btn-edge:hover        {            color: tomato;            -webkit-background-size: 100% 5px, 100% 5px, 100% 5px, 100% 5px, 5px 100%, 5px 100%, 5px 100%, 5px 100%;            background-size: 100% 5px, 100% 5px, 100% 5px, 100% 5px, 5px 100%, 5px 100%, 5px 100%, 5px 100%;            -webkit-box-shadow: inset 0 0 0 5px tomato;            box-shadow: inset 0 0 0 5px tomato;            -webkit-transition: background-size 1s, -webkit-box-shadow .4s .6s, color .4s .6s;            transition: background-size 1s, box-shadow .4s .6s, color .4s .6s;        }

Note: This article love programming Original article, reprint please indicate the original address: http://www.w2bc.com/Article/6366


Q: How does the image rotate around the center of the circle when the mouse slides over the background image? Css3 is also supported.

@-Webkit-keyframes btnRotate {0% {-webkit-transform: rotateZ (0deg);} 100% {-webkit-transform: rotateZ (360deg); }}# startMenu button: hover img {-webkit-animation: btnRotate 1.5 s linear infinite;} I tried the code above. It seems that I can only circle it.
The animation effect of css3 I used. When you move the mouse up, it will keep turning. Move the mouse away and restore it.


How to Use JS to implement special effects of displaying images and descriptions with the mouse

<Html>
<Head>
<Title> title and alt tips </title>
<Style type = "text/css">
Body {font-size: 12px; color: #000000}
Td {font-size: 12px; color: #000000}
A: link {font-size: 12px; color: #000000}
</Style>
<Script language = "javascript">
Var pltsPop = null;
Var pltsoffsetX = 12; // The distance of the pop-up window on the left or right of the mouse; 3-12 is suitable.
Var pltsoffsetY = 15; // The distance of the pop-up window below the mouse; 3-12 is suitable
Var pltsTitle = "";
Document. write ('<div id = pltsTipLayer style = "display: none; position: absolute; z-index: 10001"> </div> ');
Function pltsinits ()
{
Document. onmouseover = plts;
Document. onmousemove = moveToMouseLoc;
}
Function plts ()
{Var o = event. srcElement;
If (o. alt! = Null & o. alt! = "") {O. dypop = o. alt; o. alt = ""};
If (o. title! = Null & o. title! = "") {O. dypop = o. title; o. title = ""};
PltsPop = o. dypop;
If (pltsPop! = Null & pltsPop! = "" & Typeof (pltsPop )! = "Undefined ")
{
PltsTipLayer. style. left =-1000;
PltsTipLayer. style. display = '';
Var Msg = pltsPop. replace (/\ n/g, "<br> ");
Msg = Msg. replace (/\ 0x13/g, "<br> ");
Var re =/\ {(. [^ \ {] *) \}/ig;
If (! Re. test (Msg) pltsTitle = "" Shui Mu design alliance 』";
Else {
Re =/\ {(. [^ \ {] *) \} (. *)/ig;
PltsTitle = Msg. replace (re, "$1") + "";
Re =/\ {(. [^ \ {] *) \}/ig;
Msg = Msg. replace (re ,"");
Msg = Msg. replace (& quot ...... remaining full text>
 

Related Article

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.