How To Use Root In Css

Forums CSSHow To Use Root In Css
Staff asked 4 years ago

How To Use CSS :root Selector?

Answers (1)

Add Answer
Tarun Thummar Marked As Accepted
Staff answered 2 years ago
<html>
    <head>
        <style>
            :root {
                --main-color: hotpink;
                --pane-padding: 50px 42px;
            }
            .test-color{
                padding: var(--pane-padding);
                background-color: var(--main-color);
            }
        </style>
    </head>
    <body>
        <div class="test-color">
            testing 123
        </div>
    </body>
</html>

Check this code.

Subscribe

Select Categories