Can anyone offer some insight into my CSS odd and even selector issue? I can't seem to figure out how the gmail-message-wrapper
is being targeted in my code.
I want the 3 gmail-message-container
elements to have alternating colors, but it's not working as expected. What am I doing wrong?
HTML:
<body style="width:400px;">
<div>
<div id="gmail-message-wrapper">
<div id="gmail-message-container">
<span class="trim-text"><a href="/cdn-cgi/l/email-protection" class="__cf_email__" data-cfemail="c7b4a8aaa2e9a2aaa6aeab87b4a8aaa2e9a3a8aaa6aea9">[email protected]</a> (Some Name)</span>:
<br>
<span class="trim-text"><b>Some title</b></span>
<br>
<span class="trim-text">Some summary text goes here</span>
</div>
<div id="gmail-message-container">
<span class="trim-text"><a href="/cdn-cgi/l/email-protection" class="__cf_email__" data-cfemail="3645595b5318535b575f5a7645595b531852595b575f58">[email protected]</a> (Some Name)</span>:
<br>
<span class="trim-text"><b>Some title</b></span>
<br>
<span class="trim-text">Some summary text goes here</span>
</div>
<div id="gmail-message-container">
<span class="trim-text"><a href="/cdn-cgi/l/email-protection" class="__cf_email__" data-cfemail="0774686a6229626a666e6b4774686a622963686a666e69">[email protected]</a> (Some Name)</span>:
<br>
<span class="trim-text"><b>Some title</b></span>
<br>
<span class="trim-text">Some summary text goes here</span>
</div>
</div>
</div>
</body>
CSS:
#gmail-message-wrapper:nth-child(even) {
background-color: rgba(0, 0, 0, 0.5);
}
#gmail-message-wrapper:nth-child(odd) {
background-color: rgba(0, 0, 0, 0.1);
}