<div class="forms">
<div class="controls">
<label for="direction">direction:</label>
<select id="direction">
<option value="ltr">ltr</option>
<option value="rtl">rtl</option>
</select>
</div>
<div class="controls">
<label for="writingmode">writing-mode:</label>
<select id="writingmode">
<option value="horizontal-tb">horizontal-tb</option>
<option value="vertical-lr">vertical-lr</option>
<option value="vertical-rl">vertical-rl</option>
<option value="sideways-rl">sideways-rl</option>
<option value="sideways-lr">sideways-lr</option>
</select>
</div>
<div class="controls">
<label for="flexDirection">flex-direction:</label>
<select id="flexDirection">
<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>
</div>
</div>
<div id="container">
<div class="flex__container">
<div class="flex__item"></div>
<div class="flex__item"></div>
<div class="flex__item"></div>
<div class="flex__item"></div>
</div>
</div>
@import url("https://fonts.googleapis.com/css?family=Gochi+Hand");
* {
box-sizing: border-box;
margin: 0;
padding: 0;
}
body {
width: 100vw;
min-height: 100vh;
margin: 0;
padding: 10vh;
background-color: #291642;
font-family: "Gochi Hand", sans-serif;
font-size: 130%;
letter-spacing: 0.1rem;
color: #fff;
display: flex;
align-items: center;
flex-direction: column;
}
.forms {
display: flex;
justify-content: center;
align-items: center;
padding: 3vh;
}
.controls {
background-color: rgba(0,0,0,.1);
padding: 10px;
border-radius: .5em;
border: 1px solid rgba(0,0,0,.2);
margin: 0 10px;
}
.controls select {
font-size: .9em;
}
:root {
--writingMode: horizontal-tb;
--direction: ltr;
--flexDirection: row;
}
#container {
writing-mode: var(--writingMode);
direction: var(--direction);
margin-top: 10vh;
}
.flex__container {
display: flex;
flex-direction:var(--flexDirection);
min-inline-size: 80vh;
min-block-size: 30vh;
border: 2px solid #E91E63;
border-radius: 6px;
box-shadow: 0 0 2px 3px #ffeb3b7a, inset 0 0 2px 3px #03a9f48a;
padding: 2vh;
position: relative;
counter-reset: listCounter;
}
.flex__item {
display: flex;
justify-content: center;
align-items: center;
inline-size: 10vh;
block-size: 10vh;
margin: 2vh;
counter-increment: listCounter;
}
.flex__item::before {
content: "[" counter(listCounter) "]";
font-size: 2rem;
background: rgba(0,0,0,.65);
padding: 4px;
border-radius: 4px;
}
.flex__item:nth-child(1) {
background-color: #f36;
}
.flex__item:nth-child(2) {
background-color: #CDDC39;
}
.flex__item:nth-child(3) {
background-color: #2196F3;
}
.flex__item:nth-child(4) {
background-color: #FF5722;
}
View Compiled
const writingMode = document.getElementById("writingmode");
const direction = document.getElementById("direction");
const flexDirection = document.getElementById("flexDirection");
const documentElement = document.documentElement;
writingMode.addEventListener("change", function (evt) {
documentElement.style.setProperty("--writingMode", evt.target.value);
});
direction.addEventListener("change", function (evt) {
documentElement.style.setProperty("--direction", evt.target.value);
});
flexDirection.addEventListener("change", function (evt) {
documentElement.style.setProperty("--flexDirection", evt.target.value);
});
This Pen doesn't use any external CSS resources.
This Pen doesn't use any external JavaScript resources.