:-moz-first-node

Non-standard: This feature is not standardized. We do not recommend using non-standard features in production, as they have limited browser support, and may change or be removed. However, they can be a suitable alternative in specific cases where no standard option exists.

Experimental: This is an experimental technology
Check the Browser compatibility table carefully before using this in production.

:-moz-first-nodelớp giả CSS là một phần mở rộng Mozilla đại diện cho bất kỳ phần tử nào là nút con đầu tiên của một phần tử khác. Nó khác với :first-child ở chỗ nó không khớp với phần tử con đầu tiên có văn bản (không phải khoảng trắng) đứng trước nó.

Note: Mọi khoảng trắng ở đầu một phần tử đều bị bỏ qua khi xác định :-moz-first-node.

Cú pháp

css
:-moz-first-node {
  /* ... */
}

Ví dụ

CSS

css
span:-moz-first-node {
  background-color: lime;
}

HTML

html
<p>
  <span>This matches!</span>
  <span>This doesn't match.</span>
</p>

<p>
  Blahblah.
  <span>This doesn't match because it's preceded by text.</span>
</p>

Kết quả

Thông số kỹ thuật

Không thuộc bất kỳ tiêu chuẩn nào.

Khả năng tương thích trình duyệt

Xem thêm