Set style for direct child
<html>
<head>
<title>Set style for direct child</title>
<style type="text/css">
p > strong {
text-decoration: underline;
}
</style>
<body>
<div>
<p>Nothing happens to this part of the sentence because this
<strong>strong</strong> isn't the direct child of div.</p>
However, this <strong>strong</strong> is the child of div.
Therefore, it receives the style dictated in the CSS rule.
</div>
<body>
Related examples in the same category