last-child Selector
CSS last-child Selector reference
The CSS last-child structural pseudo-class selector ( X:last-child { } ) is used to target and style the last child of its parent element.
CSS CODE EXAMPLE
<!DOCTYPE html>
<style type="text/css">
#mydiv p:last-child {
color:#F0F;
font-weight:bold;
}
</style>
<div id="mydiv">
<p>Paragraph content...</p>
<p>Paragraph content...</p>
<p>Paragraph content...</p>
<p>Paragraph content...</p>
</div>
<style type="text/css">
#mydiv p:last-child {
color:#F0F;
font-weight:bold;
}
</style>
<div id="mydiv">
<p>Paragraph content...</p>
<p>Paragraph content...</p>
<p>Paragraph content...</p>
<p>Paragraph content...</p>
</div>
Paragraph content...
Paragraph content...
Paragraph content...
Paragraph content...
Paragraph content...
Paragraph content...
0 Response to "last-child Selector"
Post a Comment