首页 > Web开发 > 详细

css变量的引用

时间:2020-02-18 14:08:09      阅读:169      评论:0      收藏:0      [点我收藏+]
<!DOCTYPE html>
<html lang="en">
<head>
    <meta charset="UTF-8">
    <meta name="viewport" content="width=device-width, initial-scale=1.0">
    <title>Document</title>
    <style>
        html{
            /* 设置颜色变量 */
            --color:rgb(140, 0, 255);
        }
        div{
            width: 100px;
            height: 100px;
        }
        .box1{
            /* 引用颜色变量 */
            background-color: var(--color);
        }
        .box2{
            /* 引用颜色变量 */
            color:var(--color)
        }
        .box3{
            /* 引用颜色变量 */
            border: 2px solid var(--color);
        }
    </style>
</head>
<body>
    <div class="box1">1111</div>
    <div class="box2">222</div>
    <div class="box3">333</div>
</body>
</html>

css变量的引用

原文:https://www.cnblogs.com/kukai/p/12325768.html

(0)
(0)
   
举报
评论 一句话评论(0
关于我们 - 联系我们 - 留言反馈 - 联系我们:wmxa8@hotmail.com
© 2014 bubuko.com 版权所有
打开技术之扣,分享程序人生!