<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="flexFlow">flex-flow:</label>
<select id="flexFlow">
<option value="row">row</option>
<option value="row-reverse">row-reverse</option>
<option value="column">column</option>
<option value="column-reverse">column-reverse</option>
<option value="nowrap">nowrap</option>
<option value="wrap">wrap</option>
<option value="wrap-reverse">wrap-reverse</option>
<option value="row nowrap">row nowrap</option>
<option value="row wrap">row wrap</option>
<option value="row wrap-reverse">row wrap-reverse</option>
<option value="row-reverse nowrap">row-reverse nowrap</option>
<option value="row-reverse wrap">row-reverse wrap</option>
<option value="row-reverse wrap-reverse">row-reverse wrap-reverse</option>
<option value="column nowrap">column nowrap</option>
<option value="column wrap">column wrap</option>
<option value="column wrap-reverse">column wrap-reverse</option>
<option value="column-reverse nowrap">column-reverse nowrap</option>
<option value="column-reverse wrap">column-reverse wrap</option>
<option value="column-reverse wrap-reverse">column-reverse wrap-reverse</option>
</select>
</div>
<div class="controls">
<label for="alignItems">align-items:</label>
<select id="alignItems">
<option value="stretch">stretch</option>
<option value="flex-start">flex-start</option>
<option value="flex-end">flex-end</option>
<option value="center">center</option>
<option value="baseline">baseline</option>
<option value="first baseline">first baseline</option>
<option value="last baseline">last baseline</option>
<option value="start">start</option>
<option value="end">end</option>
<option value="self-start">self-start</option>
<option value="self-end">self-end</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;
--flexFlow: row nowrap;
--alignItems: stretch;
}
#container {
writing-mode: var(--writingMode);
direction: var(--direction);
margin-top: 10vh;
}
.flex__container {
display: flex;
flex-flow:var(--flexFlow);
align-items: var(--alignItems);
inline-size: 80vh;
block-size: 20vh;
border: 1px dashed #E91E63;
border-color: #FFEB3B #FF5722 #fff #00BCD4;
position: relative;
counter-reset: listCounter;
}
.flex__item {
display: flex;
justify-content: center;
align-items: center;
/* inline-size: 10vh;
block-size: 10vh; */
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(2)::before {
font-size: 4rem;
}
.flex__item:nth-child(3) {
background-color: #2196F3;
}
.flex__item:nth-child(4) {
background-color: #FF5722;
}
.flex__item:nth-child(4)::before {
font-size: 1rem;
}
View Compiled
const writingMode = document.getElementById("writingmode");
const direction = document.getElementById("direction");
const flexFlow = document.getElementById("flexFlow");
const justifyContent = document.getElementById("alignItems");
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);
});
flexFlow.addEventListener("change", function (evt) {
documentElement.style.setProperty("--flexFlow", evt.target.value);
});
alignItems.addEventListener("change", function (evt) {
documentElement.style.setProperty("--alignItems", evt.target.value);
});
This Pen doesn't use any external CSS resources.
This Pen doesn't use any external JavaScript resources.