Page Widget How to - Make Descendant Element Overwrite a Parent's Border Style








Question

We would like to know how to make Descendant Element Overwrite a Parent's Border Style.

Answer


<!DOCTYPE html>
<html>
<head>
<style type='text/css'>
.border {<!--from   w  w w.j a v a2s.com-->
  border: 1px solid #FF0000;
}

.no_border {
  border: 1px solid white;
}
</style>
</head>
<body>
  <p class="border">
    This text has a border <span class="no_border">and this text
      doesn't</span>
  </p>
</body>
</html>

The code above is rendered as follows: