Variables & Custom Properties

 <!DOCTYPE html>

<html lang="en">


<head>

    <meta charset="UTF-8">

    <meta http-equiv="X-UA-Compatible" content="IE=edge">

    <meta name="viewport" content="width=device-width, initial-scale=1.0">

    <title>CSS Variable/Custom Properties</title>

    <style>

        :root {

            --box-color: grey;

            --primary-color: blue;

            --danger-color: red;

            --maxw: 333px;

        }


        .box {

            --box-color: pink;

            width: 200px;

            height: 200px;

            background-color: var(--box-color);

            border: 2px solid red;

            box-shadow: 3px 3px var(--box-color);

            margin: 2px 9px;

        }


        .container {

            max-width: var(--maxw);

            margin: auto;

            background-color: var(--danger-color);

            display: flex;

            /* background-color: var(--box-color); */

            align-items: center;

            justify-content: center;

        }

    </style>

</head>


<body>

    <div class="container">

        <div class="box"></div>

        <div class="box"></div>

        <div class="box"></div>

    </div>

</body>


</html>

Comments

Popular posts from this blog

Transform Property In CSS

Creating Transitions in CSS