Note that there are some explanatory texts on larger screens.

plurals
  1. POCSS Bootstrap: Auto resize input field and button
    primarykey
    data
    text
    <p>I have a a text type input field, and I have a button for "Search". I would like these 2 objects to be horizontally aligned; with the button being as big as it wants to be, and the input field taking up the rest of the space. I have been trying with CSS all day, but with no avail. </p> <p>I am using RoR, and employing the Bootstrap library. I was wondering if there was anything out of the box that would make this work. I have also tried using flexboxes, but the input field seems to have a mind of its own. Below is the problematic code.</p> <pre><code>&lt;div class="mini-layout fluid"&gt; &lt;div class="mini-layout-body"&gt; &lt;h2&gt;Shows&lt;/h2&gt; &lt;/div&gt; &lt;div class="mini-layout-sidebar"&gt; &lt;div class="search_container"&gt; &lt;input id="search_shows_text" type="text" class="search-query"&gt; &lt;button id="search_shows_button" type="submit" class="btn btn-primary"&gt;Search&lt;/button&gt; &lt;/div&gt; &lt;/div&gt; &lt;/div&gt; </code></pre> <p>I've been able to get the search_container class to lay things out horizontally, but getting its children to resize appropriately has managed to escape me all day.</p> <p>Any help is greatly appreciated.</p> <p><strong>EDIT</strong> Thanks to Krishnan and the SO community I got the solution working. Below is the code for anyone else.</p> <p>HTML<br> Search </p> <p><strong>CSS</strong></p> <pre><code>.search_container { text-align:center; margin-top: 5px; } .text_area { width: 55%; //Change as per your requirement display: inline-block; margin: auto; } .but_area { width: 25%; //Change as per your requirement margin: auto; } </code></pre>
    singulars
    1. This table or related slice is empty.
    plurals
    1. This table or related slice is empty.
    1. This table or related slice is empty.
    1. This table or related slice is empty.
 

Querying!

 
Guidance

SQuiL has stopped working due to an internal error.

If you are curious you may find further information in the browser console, which is accessible through the devtools (F12).

Reload