CSS Property Value How to - Compare the background between block and inline elements








Question

We would like to know how to compare the background between block and inline elements.

Answer


<!DOCTYPE html>
<html>
<head>
<style type='text/css'>
a {<!--from w  ww .jav a 2 s  .  c om-->
  background-color: blue;
}

li {
  background-color: red;
}
</style>
</head>
<body>
  <ul>
    <li><a href="#">blabla</a></li>
    <li>blablabal</li>
  </ul>
</body>
</html>

The code above is rendered as follows: