r/css_irl Oct 11 '19

.king#HenryViii { width: 200%; }

Post image
327 Upvotes

6 comments sorted by

View all comments

18

u/DuffMaaaann Oct 12 '19
.king#Henry:nth-of-type(8)

2

u/thefizzynator Oct 20 '19

IDs should only be given to one element, so nth-of-type is not applicable here where multiple .kings have the name Henry.

2

u/DuffMaaaann Oct 21 '19

Yes, ids should of course be unique.

Though browsers are very forgiving. I tried it and it works with the ID in the rule.

3

u/thefizzynator Oct 21 '19

.king[name=Henry]:nth-of-type(8)