Set style for direct child : Child Selector : Style Basics HTML CSS TUTORIALS


HTML CSS TUTORIALS » Style Basics » Child Selector »

 

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>

 



HTML code for linking to this page:

Follow Navioo On Twitter

HTML CSS TUTORIALS

 Navioo Style Basics
» Child Selector