通过这个例子更加加深了我对css选择器的理解。目前css2和css3css类似的选择器确实只支持元素标签,不支持类名ID,据了解css4会增加一个ntn-match(),会支持上述的类名ID选择兄弟节点的功能。 参考文献 MDN:nth-of-type :nth-of-type()不起作用
The :nth-last-child() CSS pseudo-class matches elements based on their position among a group of siblings, counting from the end.
The:nth-of-typeselector allows you select one or more elements based on their source order, according to a formula. It is defined in theCSS Selectors Level 3 specas a “structural pseudo-class”, meaning it is used to style content based on its relationship with parent and sibling elements...
CSS selector: `:nth-of-type()` Global usage 97.39% + 0% = 97.39% IE ❌ 6 - 8: Not supported ✅ 9 - 10: Supported ✅ 11: Supported Edge ✅ 12 - 130: Supported ✅ 131: Supported Firefox ❌ 2 - 3: Not supported ✅ 3.5 - 132: Supported ✅ 133: Supported ✅ ...
The :nth-child() CSS pseudo-class matches elements based on the indexes of the elements in the child list of their parents. In other words, the :nth-child() selector selects child elements according to their position among all the sibling elements within
The :nth-last-child() CSS pseudo-class matches elements based on their position among a group of siblings, counting from the end.
51CTO博客已为您找到关于nth-of-type的相关内容,包含IT学习相关文档代码介绍、相关教程视频课程,以及nth-of-type问答内容。更多nth-of-type相关解答可以来51CTO博客参与分享和学习,帮助广大IT技术人实现成长和进步。
:nth-of-type bigger 3 :nth-of-type bigger 3 &:nth-of-type(4 + n) ❌ .multi-flex-box-6{flex-flow: row wrap;height:440px;.flex-item{/* not work at all ❌*/&:nth-of-type(4+ n) {.image-box{border-top:0;color: red!important;...
These pseudo-classes come in handy when you have to select specific elements in a list of siblings. To learn more about them, check the MDN Web Docs for nth-child() and nth-of-type(). Advertisement More CSS Fundamentals Learn more about CSS, and CSS selectors with these fundamental gui...
Saved searches Use saved searches to filter your results more quickly Cancel Create saved search Sign in Sign up Reseting focus {{ message }} aws-amplify / amplify-cli Public Notifications You must be signed in to change notification settings Fork 820 Star 2.8k Code Issues 669 ...