<p>Вибери потрібне значення для <code>flex-shrink</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>
<div class="box">
<pre><code>width: 750px;</code></pre>
<main>
<nav id="nav">
<pre><code>flex-shrink: <strong id="newval">1</strong>;<br>flex-basis: 350px;</code></pre>
</nav>
<section id="wrapper">
<pre><code>flex-shrink: 2;<br>flex-basis: 350px;</code>
</section>
</main>
</div>
<footer>
© 2017
</footer>
</div>
* {
box-sizing: border-box;
padding: 0;
}
body {
text-align: center;
font-family: momospace;
font-size: 15px;
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;
}
.box {
width: 750px;
border: 4px dashed red;
}
main {
display: flex;
width: 500px;
}
nav {
background-color: yellow;
flex-shrink: 1;
flex-basis: 350px;
}
#wrapper {
background-color: #eee;
flex-shrink: 2;
flex-basis: 350px;
}
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.flexShrink = this.value;
newval.innerHTML = this.value;
}
This Pen doesn't use any external CSS resources.
This Pen doesn't use any external JavaScript resources.