<div id="description">
<h1>Зміна кольору фону</h1>
<p>Цей приклад демонструє зміну кольору фону елемента з використанням функції env().</p>
</div>
<div id="result">
<div class="container">
<div class="box"></div>
<div class="box" style="--bg-color: red;"></div>
</div>
</div>
#description {
background-color: #f0f0f0;
padding: 20px;
text-align: center;
}
#description h1 {
font-family: Arial, sans-serif;
font-size: 24px;
margin-bottom: 10px;
}
#description p {
font-family: Arial, sans-serif;
font-size: 16px;
margin-bottom: 0;
}
#result {
display: flex;
justify-content: center;
align-items: center;
margin-top: 20px;
}
.container {
display: flex;
justify-content: center;
align-items: center;
height: 200px;
background-color: #f0f0f0;
}
.box {
width: 150px;
height: 150px;
margin: 0 10px;
background-color: env(--bg-color, blue);
}
This Pen doesn't use any external CSS resources.
This Pen doesn't use any external JavaScript resources.