CSS Property Value How to - font-size: inherit;








Question

We would like to know how to font-size: inherit;.

Answer


<!DOCTYPE html>
<html>
<head>
<style type='text/css'>
p {<!--   w  w  w.  ja va  2s  .c  om-->
  font-size: 16px;
}

div {
  border: 1px solid red;
  font-size: 11px;
}

div p {
  font-size: inherit;
}
</style>
</head>
<body>
  <p>test</p>
  <div class="font-size">
    <p>test</p>
    <ul>
      <li>test</li>
      <li>test</li>
    </ul>
    <p>test</p>
    <p>test</p>
  </div>
  <p>test</p>
  <p>test</p>
</body>
</html>

The code above is rendered as follows: