mozilla

Revision 41212 of :first-of-type

  • Revision slug: CSS/:first-of-type
  • Revision title: :first-of-type
  • Revision id: 41212
  • Created:
  • Creator: Miken32
  • Is current revision? No
  • Comment no wording changes

Revision Content

{{ CSSRef() }} {{ Fx_minversion_header("3") }}

Summary

The :first-of-type pseudo-class matches the first sibling of its type in the list of children of its parent element.

Syntax

element:first-of-type { style properties }

Example

To match the first data cell in a table row, you can use this:

tr > td:first-of-type

See also

  • {{ Cssxref(":nth-of-type") }}
  • {{ Cssxref(":last-of-type") }}
  • CSS3 Reference

Revision Source

<p>{{ CSSRef() }} {{ Fx_minversion_header("3") }}</p>
<h3 name="Summary">Summary</h3>
<p>The <code>:first-of-type</code> pseudo-class matches the first sibling of its type in the list of children of its parent element.</p>
<h3 name="Syntax">Syntax</h3>
<pre class="eval">element:first-of-type { <em>style properties</em> }
</pre>
<h3 name="Example">Example</h3>
<p>To match the first data cell in a table row, you can use this:</p>
<pre class="brush: css">tr &gt; td:first-of-type
</pre>
<h3 name="See_also">See also</h3>
<ul> <li>{{ Cssxref(":nth-of-type") }}</li> <li>{{ Cssxref(":last-of-type") }}</li> <li><a class="external" href="http://www.w3.org/TR/2001/CR-css3-selectors-20011113/#first-of-type-pseudo">CSS3 Reference</a></li>
</ul>
Revert to this revision