Note that there are some explanatory texts on larger screens.

plurals
  1. PO
    text
    copied!<p>Make yourself a jQuery plugin. <a href="http://jsfiddle.net/ppuGL/" rel="nofollow">http://jsfiddle.net/ppuGL/</a></p> <pre><code>$.fn.typeOverText = function() { var $ = jQuery, $this = $(this); $this.addClass('type-over'); $this.append('&lt;input type="text" class="type-over-input"&gt;'); return $this; } </code></pre> <p>Some HTML:</p> <pre><code>&lt;span class="text"&gt;Type over me&lt;/span&gt; </code></pre> <p>Invoke the plugin:</p> <pre><code>$('.text').typeOverText(); </code></pre> <p>And some CSS:</p> <pre><code>.type-over { position: relative; color: #ccc; display: inline-block; padding: 5px; } .type-over-input { position: absolute; left: 0; top: 0; width: 100%; height: 100%; background-color: transparent; font-family: inherit; font-size: inherit; border: none; margin: 0; padding: 0; padding-left: inherit; padding-right: inherit; } .type-over-input:focus { outline: 1px solid #ccc; } </code></pre> <h1>Addendum</h1> <p>Inspired by brbcoding, here's another CSS-only idea. <a href="http://jsfiddle.net/trevordixon/ppuGL/1/" rel="nofollow">http://jsfiddle.net/trevordixon/ppuGL/1/</a></p> <pre><code>&lt;span data-shadow-text="Type over me"&gt; &lt;input&gt; &lt;/span&gt; &lt;style&gt; [data-shadow-text] { font-family: sans-serif; font-size: 24px; position: relative; padding: 5px; display: inline-block; } [data-shadow-text]:before { content: attr(data-shadow-text); position: relative; color: #ccc; display: inline-block; } [data-shadow-text] input { position: absolute; left: 0; top: 0; background-color: transparent; font-family: inherit; font-size: inherit; border: none; margin: 0; padding: inherit; padding-left: inherit; padding-right: inherit; width: 100%; } [data-shadow-text] input:focus { outline: 1px solid #ccc; } &lt;/style&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