clock  Mon - Sun 8.00 AM - 8.00 PM
mail  edu@teknowize.com
fb
instagram
play store
pinterest

More

CSS Background Color

Imperial Advance Hero Image

CSS Background Color

  • It is use to color the background of any element
  • Default background color is transparent.

 

Syntax -

background: value;

or

background-color: value;

 

values :-

Color names RGB Color HEX color
HSL Color HSLA Color  

 

For example -

<!DOCTYPE html>

<html lang="en"> 

<head>
  <meta charset="UTF-8">
  <meta http-equiv="X-UA-Compatible" content="IE=edge">
  <meta name="viewport" content="width=device-width, initial-scale=1.0">
  <title>Teknowize</title>
  <style>
    h1 {
      background: green;
    }
    p {
      background: pink;
    }
  </style>
</head> 

<body>

  <h1>CSS background color</h1>
  <p>Welcome to Teknowize</p>

</body> 

</html>

 

Output

CSS

CSS