@import url("https://fonts.googleapis.com/css?family=Open+Sans:300,800");
* {
margin: 0;
padding: 0;
box-sizing: border-box;
}
html {
font-family: "Open Sans", helvetica, sans-serif;
font-size: 24px;
color: rgba(0, 0, 0, 0.5);
}
body {
background: #f9f9f9;
}
main {
position: relative;
width: 100%;
}
h1 {
padding: 20px 0 0;
font-weight: 600;
font-size: 4rem;
}
h1,
h5 {
text-align: center;
}
h5 {
margin: 0 0 20px;
}
.ruler {
position: relative;
display: block;
left: 50%;
margin: 0 0 30px -320px;
width: 640px;
height: 6px;
line-height: -20px;
background: rgba(0, 0, 0, 0.1);
}
.ruler span {
display: block;
position: absolute;
padding: 8px;
width: 80px;
top: -22px;
left: 280px;
text-align: center;
background: #efefef;
}
textarea,
input {
display: inline-block;
font-family: "Open Sans", helvetica, sans-serif;
margin: 10px;
padding: 10px;
background: rgba(255, 255, 255, 0.8);
border: 2px solid rgba(0, 0, 0, 0.1);
border-radius: 4px;
font-size: 1rem;
font-weight: 300;
color: #454545;
}
textarea:focus,
input:focus {
outline: 0;
}
textarea {
height: 300px;
}
.flexy-parent {
display: -webkit-box;
display: -ms-flexbox;
display: flex;
max-width: 800px;
margin: 0 auto;
-ms-flex-flow: row wrap;
flex-flow: row wrap;
-webkit-box-pack: center;
-ms-flex-pack: center;
justify-content: center;
-webkit-box-align: center;
-ms-flex-align: center;
align-items: center;
-ms-flex-line-pack: start;
align-content: flex-start;
}
.flexy-item {
-webkit-box-flex: 1;
-ms-flex: 1 0 300px;
flex: 1 0 300px;
}
<main>
<h1>Flex Form</h1>
<h5>SIZE WINDOW</h5>
<div class="ruler"><span>640px</span></div>
<section class="flexy-parent">
<input class="flexy-item" type="text" placeholder="Responsive input fields...">
<input class="flexy-item" type="text" placeholder="will break at 640px...">
</section>
<section class="flexy-parent">
<input class="flexy-item" type="text" placeholder="flex-grow: 1">
<input class="flexy-item" type="text" placeholder="flex-basis: 300px">
</section>
<section class="flexy-parent">
<textarea class="flexy-item" placeholder="And thanks to flexbox, everything stays nice and tidy."></textarea>
</section>
</main>