<!DOCTYPE html>
<html>
<head>
<style>
p:last-child
{
background:#ff0000;
}
</style>
</head>
<body>
<p>The first paragraph.</p>
<p>The second paragraph.</p>
<p>The third paragraph.</p>
<p>The fourth paragraph.</p>
</body>
</html>
質問:
私が変われば
p:last-child
{
background:#ff0000;
}
に
:last-child
{
background:#ff0000;
}
その後、ページ全体が赤くなりました。なぜ?p:last-child
とはどう違い:last-child
ますか?