Arrow

CSS Background Color

AuthorHariom Prajapati

Pubish Date23 Jul 2022

categoryCSS

  • 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