<div class="example">
<div class="description">
<h2>Приклад 2: використання функції color()</h2>
<p>Два елементи .box мають різний початковий фоновий колір (червоний та синій) за допомогою функції color(). Це демонструє, як можна використовувати функцію color() для встановлення кольорів в елементах і відрізняти їх між собою.</p>
</div>
<div class="result">
<div class="container">
<div class="box box1"></div>
<div class="box box2"></div>
</div>
</div>
</div>
.example {
display: flex;
flex-direction: column;
align-items: center;
margin-bottom: 50px;
}
.description {
background-color: lightgray;
padding: 20px;
font-family: Arial, sans-serif;
}
.result {
display: flex;
justify-content: center;
}
.container {
display: flex;
justify-content: center;
align-items: center;
height: 200px;
}
.box {
width: 100px;
height: 100px;
margin: 10px;
}
.box1 {
background-color: color(srgb 255 0 0);
}
.box2 {
background-color: color(srgb 0 0 255);
}
This Pen doesn't use any external CSS resources.
This Pen doesn't use any external JavaScript resources.