Note that there are some explanatory texts on larger screens.

plurals
  1. PO
    text
    copied!<p>It looks like Google uses 2 inputs, one with grey text, and another with black text. Then they are overlayed so that the grey text input is on the bottom and the black text input is on top (greater z-index it looks like).</p> <p>They grey input contains the full text plus the suggestion and the black input only displays what you typed. Hopefully this can help you figure out the code. Here's Google's html:</p> <pre><code>&lt;div style="position:relative;zoom:1"&gt; &lt;div style="position:relative;background:transparent"&gt; &lt;input type="text" maxlength="2048" id="grey" disabled="disabled" autocomplete="off" class="lst"&gt; &lt;div id="misspell" class="lst"&gt;&lt;/div&gt; &lt;/div&gt; &lt;div&gt; &lt;div class="lst" style="position: absolute; top: -900px; left: -9000px; max-width: 3000px; overflow: hidden; width: auto;"&gt;&lt;/div&gt; &lt;input type="text" maxlength="2048" name="q" class="lst" autocomplete="off" size="41" title="Search" value=""&gt; &lt;span id="tsf-oq" style="display:none"&gt;&lt;/span&gt; &lt;/div&gt; &lt;/div&gt; </code></pre> <p>EDIT: Here's a very simplified version of some html and css you could potentially use <a href="http://jsfiddle.net/JRxnR/" rel="nofollow">http://jsfiddle.net/JRxnR/</a></p> <pre><code>#grey { color: #CCC; background-color: transparent; top: 0px; left: 0px; position:absolute; } #black { color: #000; background-color: transparent; z-index: 999; top: 0px; left: 0px; position:absolute; } &lt;input id="grey" type="text" value="test auto complete" /&gt; &lt;input id="black" type="text" value="test" /&gt; </code></pre>
 

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