Note that there are some explanatory texts on larger screens.

plurals
  1. PO
    text
    copied!<p><code>height</code> and <code>width</code> can only be applied to elements with <strong>hasLayout</strong> property. SPAN element by default does not implement this property.</p> <p>Because inline-block does not work correctly on all major browsers I would recommend using padding-dimension trick:</p> <pre><code>&lt;span style="font-size:30px; padding-left:30px; background:red;"&gt;&amp;nbsp;&lt;/span&gt; </code></pre> <p>You might need to play a little bit with dimensions because global <code>font-size</code>, <code>font-family</code> and <code>line-height</code> can affect the real size of your box.</p> <p><strong>Edit:</strong> Drawing <em>empty boxes</em> is the bit I missed, but I think it is quite obvious from my code anyway. If not, this is another example:</p> <pre><code>&lt;style type="text/css"&gt; .box1 { font-size:15px; font-family:Tahoma; padding-left:15px; border:1px solid red; overflow:hidden; } .box2 { font-size:10px; font-family:Tahoma; padding-left:15px; border:1px solid green; overflow:hidden; } .box3 { font-size:5px; font-family:Tahoma; padding-left:5px; border:1px solid blue; overflow:hidden; } &lt;/style&gt; This is red box: &lt;span class="box1"&gt;&amp;nbsp;&lt;/span&gt; and this is green box: &lt;span class="box2"&gt;&amp;nbsp;&lt;/span&gt;. And this is another box, this time it is blue: &lt;span class="box3"&gt;&amp;nbsp;&lt;/span&gt;. </code></pre> <p>And this code produces this as an output: <a href="http://img413.imageshack.us/img413/5865/boxes.png">alt text http://img413.imageshack.us/img413/5865/boxes.png</a></p> <p>And because we put <code>&amp;nbsp;</code> inside every span, this trick will work on all browsers.</p>
 

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