纯CSS自定义button按钮的点击特效

纯css自定义button按钮的点击特效,实现背景变化


效果图如下:

纯CSS自定义button按钮的点击特效_第1张图片


代码如下:


<html>
<head>
    <meta charset="UTF-8">
    <title>title>
    <style>
        .btn-default {
            display: inline-block;
    padding: 6px 12px;
    margin-bottom: 0;
    font-size: 14px;
    font-weight: 400;
    line-height: 1.42857143;
    text-align: center;
    white-space: nowrap;
    vertical-align: middle;
    -ms-touch-action: manipulation;
    touch-action: manipulation;
    cursor: pointer;
    -webkit-user-select: none;
    -moz-user-select: none;
    -ms-user-select: none;
    user-select: none;
    background-image: none;
    border: 1px solid transparent;
    border-radius: 4px;

            color: #333;
    background-color: #fff;
    border-color: #ccc;

    text-shadow: 0 1px 0 #fff;
    background-image: -webkit-linear-gradient(top,#fff 0,#e0e0e0 100%);
    background-image: -o-linear-gradient(top,#fff 0,#e0e0e0 100%);
    background-image: -webkit-gradient(linear,left top,left bottom,from(#fff),to(#e0e0e0));
    background-image: linear-gradient(to bottom,#fff 0,#e0e0e0 100%);
    filter: progid:DXImageTransform.Microsoft.gradient(startColorstr='#ffffffff', endColorstr='#ffe0e0e0', GradientType=0);
    filter: progid:DXImageTransform.Microsoft.gradient(enabled=false);
    background-repeat: repeat-x;
    border-color: #dbdbdb;
    border-color: #ccc;
}

.btn-default:active, .open>.dropdown-toggle.btn-default {
    background-image: none;
}
.btn-default:active, .open>.dropdown-toggle.btn-default {
    color: #333;
    background-color: #e6e6e6;
    border-color: #adadad;
}
.btn-default:hover {
    color: #333;
    background-color: #e6e6e6;
    border-color: #adadad;
}
.btn.active, .btn:active {
    background-image: none;
    outline: 0;
    -webkit-box-shadow: inset 0 3px 5px rgba(0,0,0,.125);
    box-shadow: inset 0 3px 5px rgba(0,0,0,.125);
}

.btn.focus, .btn:focus, .btn:hover {
    color: #333;
    text-decoration: none;
}
    style>
head>
<body>
    <div class="btn-default">
        我是按钮
    div>
body>
html>

以上就是关于“ 纯CSS自定义button按钮的点击特效 ” 的全部内容。

你可能感兴趣的:(CSS,3)