Note that there are some explanatory texts on larger screens.

plurals
  1. PO
    primarykey
    data
    text
    <p>If you don't mind the help of jQuery then the following code can solve your problem.</p> <p>html code-</p> <pre><code>&lt;div id="form" class="loading"&gt; &lt;form action=""&gt; &lt;div id="container"&gt; &lt;input type="text" name="input" id="input" value=""&gt; &lt;input type="submit" name="submit" value="submit" id="s"&gt; &lt;/div&gt; &lt;/form&gt; &lt;/div&gt; </code></pre> <p>css and js-</p> <pre><code> &lt;script&gt; jQuery(document).ready(function($){ var containerWidth = $("#form #container").outerWidth(); var searchBoxWidth = jQuery("#form #s").outerWidth(); var adjustedWidth = containerWidth - searchBoxWidth - 30 // this is a value i've chosen to separate the button from the input field and the right edge of the wrapper jQuery("#form #input").width(adjustedWidth); jQuery("#form").removeClass('loading'); }); &lt;/script&gt; &lt;style&gt; .loading form{visibility:hidden;background:url(img/loader.gif) no-repeat 50% 50%} /*url should follow your own link to the gif you want to use*/ #form{width:700px;margin:200px auto;} #form #container{border-radius: 30px;height: 60px;background: #ccc;border: 0;padding:0} #form #input{height: 40px;margin: 10px 0 0 10px;border-radius: 30px;border: 0;padding:0;} #form #s{padding: 13px 28px;border: 0;border-radius: 30px;text-transform: uppercase;} &lt;/style&gt; </code></pre> <p>edit:</p> <ol> <li>I've added a class "loading" in the main wrapper to identify the loading stage. Initial I don't want any visitor see the contents inside the wrapper so that i set the rule <code>visibility:hidden</code> so that the contents will remain in the position and they are not displayed instead i'm showing a loading gif using the <code>background</code> property of the <code>loader</code> class.</li> <li>when the width of the input box is set then i'm removing the class <code>loading</code> from the wrapper so that the contents are now visible.</li> </ol>
    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.
    1. VO
      singulars
      1. This table or related slice is empty.
    2. VO
      singulars
      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