好看的按钮动画

Posted 归尘2016

tags:

篇首语:本文由小常识网(cha138.com)小编为大家整理,主要介绍了好看的按钮动画相关的知识,希望对你有一定的参考价值。

准备一张透明图

实现效果

html

<!DOCTYPE html>
<html>
<head>
<meta http-equiv="Content-Type" content="text/html; charset=utf-8" />
<title>CSS3 Animated Bubble Buttons | Tutorialzine Demo</title>

<link rel="stylesheet" type="text/css" href="css/page.css" />
<link rel="stylesheet" type="text/css" href="buttons/buttons.css" />

</head>

<body>

<div id="buttonContainer">
    
    <a href="#" class="button big blue">Big Button</a>
    
</div>
<div style="margin:20px auto"><a href="#" class="button2">Big Button</a> </div>
   
</body>
</html>

CSS样式

.button{
    font:15px Calibri, Arial, sans-serif;
    text-shadow:1px 1px 0 rgba(255,255,255,0.4);
    text-decoration:none !important;
    white-space:nowrap;
    display:inline-block;
    vertical-align:baseline;
    position:relative;
    cursor:pointer;
    padding:10px 20px;
    background-repeat:no-repeat;
    background-position:bottom left;
    background-image:url(\'button_bg.png\');
    background-position:bottom left, top right, 0 0, 0 0;
    background-clip:border-box;
    -moz-border-radius:8px;
    -webkit-border-radius:8px;
    border-radius:8px;    
    -moz-box-shadow:0 0 1px #fff inset;
    -webkit-box-shadow:0 0 1px #fff inset;
    box-shadow:0 0 1px #fff inset;
    -webkit-transition:background-position 1s;
    -moz-transition:background-position 1s;
    transition:background-position 1s;
}
.button:hover{
    background-position:top left;
    background-position:top left, bottom right, 0 0, 0 0;
}
.button.big{ font-size:30px;}
.blue.button{
    color:#0f4b6d !important;
    border:1px solid #84acc3 !important;
    background-color: #48b5f2;
    background-image:url(\'button_bg.png\'), url(\'button_bg.png\'),
                    -moz-radial-gradient(    center bottom, circle,rgba(89,208,244,1) 0,rgba(89,208,244,0) 100px),
                    -moz-linear-gradient(#4fbbf7, #3faeeb);

    background-image:url(\'button_bg.png\'), url(\'button_bg.png\'),
                    -webkit-gradient(    radial, 50% 100%, 0, 50% 100%, 100,from(rgba(89,208,244,1)), to(rgba(89,208,244,0))),
                    -webkit-gradient(linear, 0% 0%, 0% 100%, from(#4fbbf7), to(#3faeeb));
}

.blue.button:hover{
    background-color:#63c7fe;
    background-image:url(\'button_bg.png\'), url(\'button_bg.png\'),
                    -moz-radial-gradient(    center bottom, circle,rgba(109,217,250,1) 0,rgba(109,217,250,0) 100px),
                    -moz-linear-gradient(#63c7fe, #58bef7);                
    background-image:url(\'button_bg.png\'), url(\'button_bg.png\'),
                    -webkit-gradient(    radial, 50% 100%, 0, 50% 100%, 100,from(rgba(109,217,250,1)), to(rgba(109,217,250,0))),
                    -webkit-gradient(linear, 0% 0%, 0% 100%, from(#63c7fe), to(#58bef7));
}

 

以上是关于好看的按钮动画的主要内容,如果未能解决你的问题,请参考以下文章

如何设置x和y移动动画片段的最大/限制?

片段交易动画完成后执行动作

VSCode自定义代码片段——CSS动画

VSCode自定义代码片段7——CSS动画

VSCode自定义代码片段7——CSS动画

Android动画:模拟开关按钮点击打开动画(属性动画之平移动画)