6
I have the following situation. I’m working on a responsive layout that features three columns, left sidebar, center and right... It turns out that inside the right sidebar there is a text field and beside there must be an Submit button... That button can never break the line, so I used in the div (inside the sidebar) where is this form the property white-space: nowrap;
The problem is that I would like the button element to be fixed in its width and the text field to be flexible, but when the dimensions become varied this does not happen, or it grows too much, bursting the layout or becomes too small, leaving space inside the sidebar. Is there any way to fix this?
the code is as follows::
div#sidebar {
width: 23%;
}
div#sidebar div#searchbox {
display: block;
padding: 3px 5px;
margin-bottom: 4px;
white-space: nowrap;
}
div#sidebar div#searchbox input[type="text"] {
width: 100%;
}
div#sidebar div#searchbox input[type="submit"] {
width: 85px;
}
HTML:
<div id="sidebar">
<div id="searchbox">
<input type="text" name="query" />
<input type="submit" name="btn-submit" />
</div>
</div>
Place the html as well.
– Renan Gomes
ready, as requested, put...
– Erickson Ivanowski
Imagine that inside the sidebar element, you will have two more columns, one for input text and the other for Submit, the magic here is to leave one fixed and one responsive. See this link for a more detailed explanation. http://www.todoespacoonline.com/w/2014/04/05/layout-responsive/
– Tamiris
Which browser are you using? Your try seems to work: take a look at this fiddle.
– falsarella
Will your application run in browsers prior to IE9? Because an alternative is using Flexbox in CSS.
– P. Calixto