Is there a way to make the input text
element take up 100% width of its parent container (div class="input-wrapper"
) while still being responsive? Using width:inherit
makes it too wide for the entire viewport
, and width:auto
doesn't work either as it defaults to size="20"
. I need two containers with fixed widths in pixels, and a central container with a responsive input. Check out my example on Plunker.
HTML:
<div class="one"></div>
<div class="three"></div>
<div class="two">
<div class="input-wrapper">
<input type="text" id="square" />
</div>
</div>
CSS:
input {
width: auto;
}
.one {
width: 200px;
background-color: blue;
height: 60px;
float: left;
}
.two {
background-color: red;
height: 60px;
width: auto;
}
.three {
background-color: yellow;
height: 60px;
width: 150px;
float: right;
}
.input-wrapper {
width: 100%;
background-color: green;
}