Skip to content
Draft
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
38 changes: 17 additions & 21 deletions selectors-4/Overview.bs
Original file line number Diff line number Diff line change
Expand Up @@ -2949,16 +2949,15 @@ Child-indexed Pseudo-classes</h3>
<h4 id="the-nth-child-pseudo">
'':nth-child()'' pseudo-class</h4>

The <dfn id='nth-child-pseudo' lt=":nth-child()">:nth-child(<var>An+B</var> [of <var>S</var>]? )</dfn>
The <dfn id='nth-child-pseudo' lt=":nth-child()">:nth-child(<<an-b>> [of <<complex-real-selector-list>>]?)</dfn>
pseudo-class notation represents elements that
are among <var>An+B</var>th elements
from the list composed of
their <a>inclusive siblings</a> that match the <a>selector list</a> <var>S</var>,
which is a <<complex-real-selector-list>>.
If <var>S</var> is omitted,
their <a>inclusive siblings</a> that match the <a>selector list</a> <<complex-real-selector-list>>.
If the selector list is omitted,
it defaults to ''*|*''.

The <var>An+B</var> notation and its interpretation
Note: The <var>An+B</var> notation and its interpretation
are defined in [[css-syntax-3#anb-microsyntax]];
it represents any index <var>i</var> = <var>A</var><var>n</var> + <var>B</var>
for any non-negative integer <var>n</var>.
Expand All @@ -2983,11 +2982,11 @@ Child-indexed Pseudo-classes</h3>

Note: The specificity of the '':nth-child()'' pseudo-class is
the specificity of a single pseudo-class plus,
if <var>S</var> is specified,
if the selector list <var>S</var> is specified,
the specificity of the most specific <a>complex selector</a> in <var>S</var>.
See [[#specificity-rules]].
Thus ''<var>S</var>:nth-child(<var>An+B</var>)''
and '':nth-child(<var>An+B</var> of <var>S</var>)''
Thus ''<var>S</var>:nth-child(<<an-b>>)''
and '':nth-child(<<an-b>> of <var>S</var>)''
have the exact same specificity,
although they do differ in behavior
(see example below).
Expand Down Expand Up @@ -3045,14 +3044,13 @@ Child-indexed Pseudo-classes</h3>
<h4 id="the-nth-last-child-pseudo">
'':nth-last-child()'' pseudo-class</h4>

The <dfn id='nth-last-child-pseudo' lt=":nth-last-child()">:nth-last-child(<var>An+B</var> [of <var>S</var>]? )</dfn>
The <dfn id='nth-last-child-pseudo' lt=":nth-last-child()">:nth-last-child(<<an-b>> [of <<complex-real-selector-list>>]?)</dfn>
pseudo-class notation represents elements that
are among <var>An+B</var>th elements
from the list composed of
their <a>inclusive siblings</a> that match the <a>selector list</a> <var>S</var>,
their <a>inclusive siblings</a> that match the <a>selector list</a> <<complex-real-selector-list>>,
counting backwards from the end.
<var>S</var> is <<complex-real-selector-list>>.
If <var>S</var> is omitted,
If the selector list is omitted,
it defaults to ''*|*''.

Note: The specificity of the '':nth-last-child()'' pseudo-class,
Expand All @@ -3061,7 +3059,7 @@ Child-indexed Pseudo-classes</h3>
with that of its selector argument <var>S</var>.
See [[#specificity-rules]].

The CSS Syntax Module [[!CSS3SYN]] defines the <a href="https://drafts.csswg.org/css-syntax/#anb"><var>An+B</var> notation</a>.
Note: The CSS Syntax Module [[!CSS3SYN]] defines the <a href="https://drafts.csswg.org/css-syntax/#anb"><var>An+B</var> notation</a>.

<div class="example">
Examples:
Expand Down Expand Up @@ -3150,7 +3148,7 @@ Typed Child-indexed Pseudo-classes</h3>
<h4 id="the-nth-of-type-pseudo">
'':nth-of-type()'' pseudo-class</h4>

The <dfn id='nth-of-type-pseudo' lt=":nth-of-type()">:nth-of-type(<var>An+B</var>)</dfn> pseudo-class notation
The <dfn id='nth-of-type-pseudo' lt=":nth-of-type()">:nth-of-type(<<an-b>>)</dfn> pseudo-class notation
represents the same elements that would be matched by '':nth-child(|An+B| of |S|)'',
where |S| is a [=type selector=] and namespace prefix matching the element in question.
For example,
Expand All @@ -3177,7 +3175,7 @@ Typed Child-indexed Pseudo-classes</h3>
<h4 id="the-nth-last-of-type-pseudo">
'':nth-last-of-type()'' pseudo-class</h4>

The <dfn id='nth-last-of-type-pseudo' lt=":nth-last-of-type()">:nth-last-of-type(<var>An+B</var>)</dfn> pseudo-class notation
The <dfn id='nth-last-of-type-pseudo' lt=":nth-last-of-type()">:nth-last-of-type(<<an-b>>)</dfn> pseudo-class notation
represents the same elements that would be matched by '':nth-last-child(|An+B| of |S|)'',
where |S| is a [=type selector=] and namespace prefix matching the element in question.
For example,
Expand Down Expand Up @@ -3438,7 +3436,7 @@ Column combinator (<code>||</code>)</h3>
<h3 id="the-nth-col-pseudo">
'':nth-col()'' pseudo-class</h3>

The <dfn id='nth-col-pseudo' lt=":nth-col()">:nth-col(<var>An+B</var>)</dfn>
The <dfn id='nth-col-pseudo' lt=":nth-col()">:nth-col(<<an-b>>)</dfn>
pseudo-class notation represents a cell element belonging to a column
that has <var>An+B</var>-1 columns
<strong>before</strong> it, for any positive
Expand All @@ -3448,14 +3446,12 @@ Column combinator (<code>||</code>)</h3>
more than one column, it is represented by a selector indicating any of
those columns.

The CSS Syntax Module [[!CSS3SYN]] defines the <a href="https://drafts.csswg.org/css-syntax/#anb"><var>An+B</var> notation</a>.


Note: The CSS Syntax Module [[!CSS3SYN]] defines the <a href="https://drafts.csswg.org/css-syntax/#anb"><var>An+B</var> notation</a>.

<h3 id="the-nth-last-col-pseudo">
'':nth-last-col()'' pseudo-class</h3>

The <dfn id='nth-last-col-pseudo' lt=":nth-last-col()">:nth-last-col(<var>An+B</var>)</dfn>
The <dfn id='nth-last-col-pseudo' lt=":nth-last-col()">:nth-last-col(<<an-b>>)</dfn>
pseudo-class notation represents a cell element belonging to a column
that has <var>An+B</var>-1 columns
<strong>after</strong> it, for any positive
Expand All @@ -3465,7 +3461,7 @@ Column combinator (<code>||</code>)</h3>
more than one column, it is represented by a selector indicating any of
those columns.

The CSS Syntax Module [[!CSS3SYN]] defines the <a href="https://drafts.csswg.org/css-syntax/#anb"><var>An+B</var> notation</a>.
Note: The CSS Syntax Module [[!CSS3SYN]] defines the <a href="https://drafts.csswg.org/css-syntax/#anb"><var>An+B</var> notation</a>.

<h2 id="specificity-rules">
Calculating a selector's specificity</h2>
Expand Down