0
点赞
收藏
分享

微信扫一扫

CSS动态增加立体效果

mjjackey 2022-01-16 阅读 66
<!DOCTYPE html>
<html lang="en">
<head>
    <meta charset="UTF-8">
    <title>Title</title>
    <style>
        .show{
            width: 150px;
            height: 50px;
            text-align: center;
            line-height: 50px;
            border-right:#222222 20px solid ;
            border-bottom:#222222 20px solid ;
            border-left:#dddddd 20px solid ;
            border-top:#dddddd 20px solid ;
            background-color:#cccccc ;
        }
    </style>
</head>
<body>
<input type="button" value="动态增加立体效果" onclick="change()"> <hr/>
<div id="box">立体效果</div>

</body>
</html>
<script>
    function change() {
        document.getElementById("box").className="show";   //给box添加show样式
    }
</script>

 

举报

相关推荐

0 条评论