Note that there are some explanatory texts on larger screens.

plurals
  1. PO
    text
    copied!<p>There's no real right answer to this, since there's literally many ways to do this, but if you're just asking for an opinion to keep it simple, this is what I would do. However, that does not mean it is the best thing to do.</p> <pre><code>&lt;style type="text/css"&gt; .header { position:absolute; height:200px; width:700px; } /*change width/height to actual size*/ a.link { background-image:url(t.png); display:block; left:0px; top:0px; z-index:1; } a.icon { display:block; position:absolute; top:50px; height:32px; width:32px; z-index:2; } /*assuming icons are same size*/ a.fb { background-image:url(b.png); right:94px; } /* 3 10px spacers plus 2 icons widths */ a.tw { background-image:url(a.png); right:52px; } /* 2 10px spacers plus 1 icon width */ a.yt { background-image:url(r.png); right:10px; } /* 1 10px spacer */ &lt;/style&gt; &lt;div class="header"&gt; &lt;a class="header link" href="#"&gt;&lt;/a&gt; &lt;a class="icon fb" href="http://www.facebook.com/"&gt;&lt;/a&gt; &lt;a class="icon tw" href="http://www.twitter.com/"&gt;&lt;/a&gt; &lt;a class="icon yt" href="http://www.youtube.com/"&gt;&lt;/a&gt; &lt;/div&gt; </code></pre> <p>If you're going to take the anchor background image approach, you're going to need to set the anchor to a block, and then set the dimensions of that block, as seen in the example.</p> <p>A nice trick is to combine all of your icons into a single image, that way you only need to load one image, so there's less header calls. You then use the <code>background-position</code> CSS property to re-position the background image for each icon. For this example, we assume you have three 32x32 icons, which would make one 96x32 image.</p> <pre><code>&lt;style type="text/css"&gt; .header { position:absolute; height:200px; width:700px; } /*change width/height to actual size*/ a.link { background-image:url(t.png); display:block; left:0px; top:0px; z-index:1; } a.icon { background-image:url(x.png); display:block; position:absolute; top:50px; height:32px; width:32px; z-index:2; } /*assuming icons are same size*/ a.fb { background-position:0px 0px; right:94px; } /* 3 10px spacers plus 2 icons widths */ a.tw { background-position:-32px 0px; right:52px; } /* 2 10px spacers plus 1 icon width */ a.yt { background-position:-64px 0px; right:10px; } /* 1 10px spacer */ &lt;/style&gt; &lt;div class="header"&gt; &lt;a class="header link" href="#"&gt;&lt;/a&gt; &lt;a class="icon fb" href="http://www.facebook.com/"&gt;&lt;/a&gt; &lt;a class="icon tw" href="http://www.tweeter.com/"&gt;&lt;/a&gt; &lt;a class="icon yt" href="http://www.youtube.com/"&gt;&lt;/a&gt; &lt;/div&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