CSS Property Value How to - background: red;








Question

We would like to know how to background: red;.

Answer


<!DOCTYPE html>
<html>
<head>
<title>Specific Div Colors</title>
<style type='text/css'>
div {<!--from  w w  w.j av  a  2 s. c om-->
  background: red;
}

div.foo, div.bar {
  background: green;
}
</style>
</head>
<body>
  <div class="foo bar">green</div>
  <div class="foo">green</div>
  <div class="bar">green</div>
  <div class="something-else">red</div>
</body>
</html>

The code above is rendered as follows: