HTML Element Style How to - Change background color and color








Question

We would like to know how to change background color and color.

Answer


<!DOCTYPE html>
<html>
<head>
<style type='text/css'>
pre {<!--  w w  w.ja va2s  .c om-->
  color: light-grey;
  background-color: orange;
  padding-top: 1em;
  margin: 15px 0 15px 0;
  width: 585px;
}
</style>
</head>
<body>
  <div class="content">
    Lorem ipsum dolor sit amet, consectetur adipisicing elit, sed do
    eiusmod tempor incididunt ut labore et dolore magna aliqua. Ut enim ad
    minim veniam, quis nostrud exercitation ullamco laboris nisi ut
    aliquip ex ea commodo consequat.
    <pre>
.wrapper {
    width: 100%;
    color: $orange;
}
</pre>
    Excepteur sint occaecat cupidatat non proident, sunt in culpa qui
    officia deserunt mollit anim id est laborum.
  </div>
</body>
</html>

The code above is rendered as follows: