<p>Вибери потрібне значення(пікселі) для <code>flex-basis</code> (для лівої навігації):</p>
<input type="number" value="200" 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">200</strong>px;</code></pre>
</nav>
<section id="wrapper">
<pre><code>flex-basis: auto;</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 {
background-color: yellow;
flex-basis: 200px;
}
nav a {
display: block;
margin-bottom: 16px;
text-align: left;
text-decoration: none;
color: #151515;
}
#wrapper {
flex-basis: auto;
background-color: #eee;
}
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.flexBasis = this.value + 'px';
newval.innerHTML = this.value;
}
This Pen doesn't use any external CSS resources.
This Pen doesn't use any external JavaScript resources.