What I learned about nth-child selectors

Today I learned an interesting fact about how the nth-child CSS selector works and it was different to what I expected and what seems to make sense.
I had the following HTML snippet:
<div class="input-group"> <div class="legacy&…


This content originally appeared on Posts on LINQ to Fail and was authored by Posts on LINQ to Fail

Today I learned an interesting fact about how the nth-child CSS selector works and it was different to what I expected and what seems to make sense. I had the following HTML snippet: <div class="input-group"> <div class="legacy"> <div class="input-subgroup"> <input name="itemId" id="Type0" type="radio" checked="checked" value="1"> <label for="Type0">Single</label> </div> <div class="input-subgroup"> <input name="itemId" id="Type1" type="radio" value="2"> <label for="Type1">Couple</label> </div> <div class="input-subgroup"> <input name="itemId" id="Type2" type="radio" value="3"> <label for="Type2">Family</label> </div> </div> <div class="new"> <div class="input-subgroup"> <input name="somethingElse" id="somethingElse" type="text" maxlength="2" placeholder="Enter" value=""> </div> <div class="input-subgroup"> <input name="somethingElse2" id="somethingElse2" type="text" maxlength="2" placeholder="Enter" value=""> </div> </div> </div> And I wanted to find the input[type="radio"] at a particular position in the DOM.


This content originally appeared on Posts on LINQ to Fail and was authored by Posts on LINQ to Fail


Print Share Comment Cite Upload Translate Updates
APA

Posts on LINQ to Fail | Sciencx (2014-03-06T00:00:00+00:00) What I learned about nth-child selectors. Retrieved from https://www.scien.cx/2014/03/06/what-i-learned-about-nth-child-selectors/

MLA
" » What I learned about nth-child selectors." Posts on LINQ to Fail | Sciencx - Thursday March 6, 2014, https://www.scien.cx/2014/03/06/what-i-learned-about-nth-child-selectors/
HARVARD
Posts on LINQ to Fail | Sciencx Thursday March 6, 2014 » What I learned about nth-child selectors., viewed ,<https://www.scien.cx/2014/03/06/what-i-learned-about-nth-child-selectors/>
VANCOUVER
Posts on LINQ to Fail | Sciencx - » What I learned about nth-child selectors. [Internet]. [Accessed ]. Available from: https://www.scien.cx/2014/03/06/what-i-learned-about-nth-child-selectors/
CHICAGO
" » What I learned about nth-child selectors." Posts on LINQ to Fail | Sciencx - Accessed . https://www.scien.cx/2014/03/06/what-i-learned-about-nth-child-selectors/
IEEE
" » What I learned about nth-child selectors." Posts on LINQ to Fail | Sciencx [Online]. Available: https://www.scien.cx/2014/03/06/what-i-learned-about-nth-child-selectors/. [Accessed: ]
rf:citation
» What I learned about nth-child selectors | Posts on LINQ to Fail | Sciencx | https://www.scien.cx/2014/03/06/what-i-learned-about-nth-child-selectors/ |

Please log in to upload a file.




There are no updates yet.
Click the Upload button above to add an update.

You must be logged in to translate posts. Please log in or register.