<!DOCTYPE html>
<html>
<head>
    <meta charset="utf-8">
    <meta http-equiv="X-UA-Compatible" content="IE=edge">
    <title>按钮动画</title>
    <link rel="stylesheet" href="">
    <style>
    .button{
        display: inline-block;
        border-radius: 4px;
        background-color: #f4511e;
        border: none;
        color: white;
        text-align: center;
        font-size: 28px;
        padding: 20px;
        width: 200px;
        transition: all 0.5s;
        cursor: pointer;
        margin: 5px;
    }
    .button span{
        cursor: pointer;
        display: inline-block;
        position: relative;
        transition: 0.5s;
    }
    .button span:after{
        content: '»';
        display: inline-block;
        opacity: 0;
        top: 0;
        right: -20px;
        transition: 0.5s;
    }
    .button:hover span{
        padding-right: 25px;
    }
    .button:hover span:after{
        opacity: 1;
        right: 0;
    }
    </style>
</head>
<body>
    <button class="button"><span>Hover </span></button>
</body>
</html>

标签:前端

你的评论