When utilizing the CSS nth-child
selector, I am encountering some peculiar issues.
The HTML structure is as follows:
<div class="block feature-callout-c" id="overview">
<div class="row">
<div class="span twelve">
<span class="intro">ABCD</span>
</div>
</div>
<div class="row number">
<div class="span two"> </div>
<div class="span two data-stat">
<i class="text">500M</i>
<p><span class="faux-tip">Tweets</span></p>
</div>
<div class="span two data-stat">
<i class="text">20M+</i>
<p><span class="faux-tip">Blog Posts</span></p>
</div>
<div class="span two data-stat">
<i class="text">200M</i>
<p><span class="faux-tip">bitly Clicks</span></p>
</div>
<div class="span two data-stat">
<i class="text">85M</i>
<p><span class="faux-tip">Tumblr Posts</span></p>
</div>
<div class="span two"> </div>
</div>
</div>
The issue arises when using the following CSS code that fails to select anything:
DIV.block.feature-callout-c#overview:nth-child(2)
DIV.row.number:nth-child(2)
DIV.span.two.data-stat:nth-child(1)
I.text
However, this CSS selection works correctly:
DIV.block.feature-callout-c#overview:nth-child(2)
DIV.row.number:nth-child(2)
DIV.span.two.data-stat:nth-child(2)
P
SPAN.faux-tip
Can someone shed light on what might be causing this inconsistency?
This approach with CSS selectors may not be the most efficient. I have a specific requirement that demands a unique selector for each element.