mozilla

Compare Revisions

:last-child

Change Revisions

Revision 40997:

Revision 40997 by Fredchat on

Revision 40998:

Revision 40998 by Miken32 on

Title:
:last-child
:last-child
Slug:
CSS/:last-child
CSS/:last-child
Tags:
css, "CSS Reference", Selectors
css, "CSS Reference", Selectors
Content:

Revision 40997
Revision 40998
nn10    <h3 name="Summary">
11      Summary
12    </h3>
n11      Selects any element that is the last child element of its pn14      The <code>:last-child</code> pseudo-class matches any eleme
>arent.>nt that is the last child element of its parent.
nn16    <h3 name="Syntax">
17      Syntax
18    </h3>
19    <pre class="eval">
20element:last-child { <em>style properties</em> }
21</pre>
n14      Ex:<br>n23      &nbsp;&nbsp;
15      ul li:last-child{color: green}
nn25    <h3 name="Examples">
26      Examples
27    </h3>
28    <pre class="brush: css">
29span:last-child
30{
31    background-color: lime;
32}
33</pre>
n18      &lt;ul&gt;<br>n35      ...where...
19      &lt;li&gt;one&lt;/li&gt;<br>
20      &lt;li&gt;<span style="color: green">two</span>&lt;/li&gt;<
>br> 
21      &lt;/ul&gt;
nn37    <pre class="brush: html">
38  &lt;div&gt;
39    &lt;span&gt;This span is not limed.&lt;/span&gt;
40    &lt;span&gt;This span is! :)&lt;/span&gt;
41  &lt;/div&gt;
42</pre>
n24      <br>n44      ... should look like ...<br>
45      <span>This span is not limed.</span> <span style="backgroun
 >d-color: lime;">This span is!&nbsp;:)</span>
tt47    <h3 name="Notes">
48      Notes
49    </h3>
50    <p>
26    <div class="noinclude"></div>{{ languages( { "fr": "fr/CSS/:l51      {{ languages( { "fr": "fr/CSS/:last-child", "pl": "pl/CSS/:
>ast-child", "pl": "pl/CSS/:last-child" } ) }}>last-child" } ) }}
52    </p>

Back to History