<header>
<h2 class="title">element.style.flexFlow</h2>
<p class="description">Встановлює або повертає значення властивостей напрямку та обтікання flex-контейнера.</p>
</header>
<main>
<div class="controls">
<label for="direction">Direction:</label>
<select id="direction">
<option value="row">row</option>
<option value="row-reverse">row-reverse</option>
<option value="column">column</option>
<option value="column-reverse">column-reverse</option>
</select>
<label for="wrap">Wrap:</label>
<select id="wrap">
<option value="nowrap">nowrap</option>
<option value="wrap">wrap</option>
<option value="wrap-reverse">wrap-reverse</option>
</select>
<button id="applyButton">Apply</button>
</div>
<div class="result" id="container">
<div class="box">1</div>
<div class="box">2</div>
<div class="box">3</div>
<div class="box">4</div>
<div class="box">5</div>
</div>
</main>
body {
font-size: 16px;
line-height: 1.5;
font-family: monospace;
}
header {
background-color: #f1f1f1;
margin-bottom: 25px;
padding: 15px;
box-shadow: 0px 0px 3px 0px rgba(118, 118, 118, 1);
box-shadow: 0px 0px 3px 0px rgba(118, 118, 118, 1);
box-shadow: 0px 0px 3px 0px rgba(118, 118, 118, 1);
}
header h2.title {
padding-bottom: 15px;
border-bottom: 1px solid #999;
}
header p.description {
font-style: italic;
color: #222;
}
.controls {
margin-bottom: 15px;
}
.result {
background-color: #f8f8f8;
padding: 15px;
display: flex;
box-shadow: 0px 0px 3px 0px rgba(118, 118, 118, 1);
box-shadow: 0px 0px 3px 0px rgba(118, 118, 118, 1);
box-shadow: 0px 0px 3px 0px rgba(118, 118, 118, 1);
}
.box {
background-color: #4CAF50;
color: white;
padding: 20px;
margin: 5px;
text-align: center;
flex: 1;
}
const container = document.getElementById('container');
const directionSelect = document.getElementById('direction');
const wrapSelect = document.getElementById('wrap');
const applyButton = document.getElementById('applyButton');
applyButton.addEventListener('click', () => {
const direction = directionSelect.value;
const wrap = wrapSelect.value;
container.style.flexFlow = `${direction} ${wrap}`;
});
This Pen doesn't use any external CSS resources.
This Pen doesn't use any external JavaScript resources.