Note that there are some explanatory texts on larger screens.

plurals
  1. POCSS Icons & Sprites & Navigation
    primarykey
    data
    text
    <p>I'm creating a little navigation system and though I'd try my hand a CSS sprites...</p> <p>My HTML is as follows </p> <pre><code>&lt;ul&gt; &lt;li&gt;&lt;i class="collections"&gt;&lt;/i&gt;&lt;a href="collections.html"&gt;My Collections&lt;/a&gt;&lt;/li&gt; &lt;li&gt;&lt;i class="everything"&gt;&lt;/i&gt;&lt;a href="everything.html"&gt;Everything&lt;/a&gt;&lt;/li&gt; &lt;li&gt;&lt;i class="social"&gt;&lt;/i&gt;&lt;a href="social.html"&gt;Social&lt;/a&gt;&lt;/li&gt; &lt;li&gt;&lt;i class="news"&gt;&lt;/i&gt;&lt;a href="news.html"&gt;News&lt;/a&gt;&lt;/li&gt; &lt;li&gt;&lt;i class="shopping"&gt;&lt;/i&gt;&lt;a href="shopping.html"&gt;Shopping&lt;/a&gt;&lt;/li&gt; &lt;li&gt;&lt;i class="financial"&gt;&lt;/i&gt;&lt;a href="financial"&gt;Financial&lt;/a&gt;&lt;/li&gt; &lt;li&gt;&lt;i class="travel"&gt;&lt;/i&gt;&lt;a href="travel"&gt;Travel&lt;/a&gt;&lt;/li&gt; &lt;li&gt;&lt;i class="entertainment"&gt;&lt;/i&gt;&lt;a href="entertainment"&gt;Entertainment&lt;/a&gt;&lt;/li&gt; &lt;/ul&gt; </code></pre> <p>I'm using for the icons (as the Twitter Bootstrap does this).</p> <p>My CSS is</p> <pre><code>i { display: block; background-image: url('../img/sprites.png'); background-repeat: no-repeat; background-position: top left; } .entertainment:hover{ background-position: -32px 0; width: 16px; height: 11px; } .entertainment{ background-position: -58px 0; width: 16px; height: 11px; } .everything:hover{ background-position: -84px 0; width: 16px; height: 15px; } .everything{ background-position: -110px 0; width: 16px; height: 15px; } .collections:hover{ background-position: -136px 0; width: 16px; height: 16px; } .collections{ background-position: -162px 0; width: 16px; height: 16px; } .news:hover{ background-position: -188px 0; width: 16px; height: 16px; } .news{ background-position: -214px 0; width: 16px; height: 16px; } .shopping:hover{ background-position: -240px 0; width: 16px; height: 16px; } .shopping{ background-position: -266px 0; width: 16px; height: 16px; } .social:hover{ background-position: -313px 0; width: 16px; height: 16px; } .social{ background-position: -339px 0; width: 16px; height: 16px; } .travel:hover{ background-position: -365px 0; width: 16px; height: 16px; } .travel{ background-position: -391px 0; width: 16px; height: 16px; } .financial:hover{ background-position: -417px 0; width: 16px; height: 12px; } .financial{ background-position: -443px 0; width: 16px; height: 12px; } </code></pre> <p>The issue I have is I'd like the icon to change on hover but it only does it on the <code>&lt;i&gt;</code> element. I have stuff going on in the <code>&lt;li&gt;</code> and the <code>&lt;a&gt;</code> that conflicts it all.</p> <p>Any ideas?</p> <p>A JS Fiddle - <a href="http://jsfiddle.net/sturobson/5t6XE/" rel="nofollow">http://jsfiddle.net/sturobson/5t6XE/</a></p>
    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. This table or related slice is empty.
    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