This CSS tutorial explains how to use the CSS selector called :first-child with syntax and examples. The CSS :first-child selector allows you to target an element that is the first child element within its parent.
The:first-child selectoris a pseudo-class in CSS that allows you to target the first child element within a parent container. It selects elements that are the first immediate child of their parent. This powerful selector makes it easier to apply unique styles or modifications to that specific...
The :first-child selector matches the first child element.:first-child is a Pseudo-class and it applies to any element that is the first child of another element. With :first-child pseudo-class, an element is matched only when it is the first child of another element. For example, p:...
Here the :first-child pseudo class style applies to allpdirect child elements of div of class foo. To apply style to all direct child and descendant p elements we could have used.foo p:first-child. See more info atCSS direct child vs any descendant selector. :first-child negative example...
:first-child表示“是父元素的第一个子节点”。 :last-child表示“是父元素的最后一个子节点”。 :first-of-type表示“是父元素的第一个对应元素的子节点”。 :last-of-type表示“是父元素的最后一个对应元素的子节点”。 <p> <span>p :first-child 或者 span:first-child</span> <a>p a:first-of-...
:first-child :first-letter :first-line :hover :last-child :link :nth-child :nth-last-child :only-child :visited child (>) descendant CSS:nth-child selector This CSS tutorial explains how to use the CSS selector called:nth-childwith syntax and examples. ...
This pseudo-class matches an element only if it’s the first child element of its parent element.
(1)first-child:第一个后代元素 (2)last-child:最后一个后代元素 (3)nth-child(N):指定第N个后代元素 下面举例: (1)input:first-child 定位所有层次第一个为input的元素,注意是第一个元素为input标签的 (2)span input:first-child 定位span标签下,第一个为input标签的元素 ...
Version 2.5.16 Reproduction link https://jsfiddle.net/eywraw8t/213640/ Steps to reproduce Create a CSS class with the selector :first-child and apply it on an element with the directive v-for. What is expected? The first element of the l...