Note that there are some explanatory texts on larger screens.

plurals
  1. POcss :nth-child randomly skips a list item
    primarykey
    data
    text
    <p>I'm posting here after trying to resolve my problem on my own for a couple of days. I have an unordered list whose list items contain several things including a div I use to display an image coming from a sprite.</p> <p>Here is the html :</p> <pre><code>&lt;ul class="upperList clearfix"&gt; &lt;li&gt; &lt;h3&gt;Kit détecteur extérieur images&lt;/h3&gt; &lt;p&gt;&lt;/p&gt; &lt;div class="extrasLiBg"&gt;&lt;/div&gt; &lt;p class="description"&gt;Lorem ipsum dolor sit amet, consectetur adipisicing elit, sed do eiusmod tempor incididunt ut labore et dolore magna aliqua. Ut enim ad minim veniam, quis nostrud exercitation ullamco laboris nisi ut aliquip ex ea commodo consequat. Duis aute irure dolor in reprehenderit in voluptate velit esse cillum dolore eu fugiat nulla pariatur. Excepteur sint occaecat cupidatat non proident, sunt in culpa qui officia deserunt mollit anim id est laborum.&lt;/p&gt; &lt;/li&gt; &lt;li&gt; &lt;h3&gt;Bouton anti hold-up avec capture d'images&lt;/h3&gt; &lt;div class="extrasLiBg"&gt;&lt;/div&gt; &lt;/li&gt; &lt;li&gt; &lt;h3&gt;Pendentif Verisure [me]&lt;/h3&gt; &lt;div class="extrasLiBg"&gt;&lt;/div&gt; &lt;/li&gt; &lt;/ul&gt; </code></pre> <p>And here is the css :</p> <pre><code> .extrasLiBg { width:100px; height:100px; position:absolute; bottom:0; right:0; overflow:hidden; background:url('images/extras-sprite.jpg') no-repeat; } .extras .upperList li:nth-child(2) .extrasLiBg {background-position:-100px 0;} .extras .upperlist li:nth-child(3) .extrasLiBg {background-position:-200px 0;} </code></pre> <p>My problem is, the div within the last list item somehow refuses to shift the background image, and thus displays the first, top left image in the sprite... It's driving me nuts, there are other lists on the page too and their div have no problem displaying the right part of the sprite...</p> <p>I'm using Chrome 10 btw, but the problem remains in Firefox, Safari and Opera (most recent releases).</p> <p>Thanks for any help.</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.
 

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