<p>Вибери потрібне значення для <code>flex</code> (для лівої навігації):</p>
<input type="number" min="0" value="1" id="field"></input>
<p id="text"></p>
<hr>
<div class="layout">
<header>
<h4>Simple website</h4>
</header>
<main>
<nav id="nav">
<pre><code>flex: <strong id="newval">1</strong>;</code></pre>
</nav>
<section id="wrapper">
<pre><code>flex: 3;</code>
</section>
</main>
<footer>
© 2017
</footer>
</div>
* {
box-sizing: border-box;
padding: 0;
}
body {
text-align: center;
font-family: momospace;
font-size: 17px;
line-height: 1.5;
color: #222;
}
#field {
padding: 8px 16px;
font-size: 19px;
}
header {
line-height: 75px;
text-align: center;
text-transform: uppercase;
background-color: #808080;
color: #f9f9f9;
}
main {
display: flex;
}
nav {
flex: 1;
background-color: yellow;
}
nav a {
display: block;
margin-bottom: 16px;
text-align: left;
text-decoration: none;
color: #151515;
}
#wrapper {
flex: 3;
background-color: #eee;
display: flex;
justify-content: center;
align-content: center;
}
.child {
width: 25%;
line-height: 30px;
color: #f1f1f1;
border-radius: 4px;
background-color: #666;
border: 2px solid #000;
}
.child-1 {
height: 45px;
}
.child-2 {
height: 125px;
}
.child-3 {
height: 75px;
}
#block {
background-color: red;
}
footer {
line-height: 50px;
background-color: #000;
color: #f1f1f1;
margin-top: 16px;
}
var nav = document.getElementById('nav');
var newval = document.getElementById('newval');
document.getElementById('field').onchange = function() {
nav.style.flex = this.value;
newval.innerHTML = this.value;
}
This Pen doesn't use any external CSS resources.
This Pen doesn't use any external JavaScript resources.