'How to Display Variable content
Is there a way to display my CSS-Variable's Content to my HTML webpage?
My Variable's name is --pick-container-width
and its Content is 5vh
.
Now I want (for testing Reasons) to display the Content to an <h1>
but idk how...
Solution 1:[1]
You would use the var()
function. Below is an example.
:root {
--color: crimson;
}
.title {
color: var(--color);
}
<h1 class="title">I am a title tag!</h1>
Sources
This article follows the attribution requirements of Stack Overflow and is licensed under CC BY-SA 3.0.
Source: Stack Overflow
Solution | Source |
---|---|
Solution 1 | JayDev95 |