CSS Backgrounds

Home / CSS / CSS Backgrounds

CSS Backgrounds


The CSS background properties are used to add background effects for elements.

Background Color:

Example:

<head>
    <style>
        p {
            background-color: chartreuse;
        }
    </style>
</head>
<body>
        <p>Hello World!</p>
    <p>Saksham Digital Technology</p>
</body>


Output:  

Example:

<head>
    <style>
        p {
            background-color: red;
        }
    </style>
</head>
<body>
        <p>Hello World!</p>
    <p>Saksham Digital Technology</p>
</body>


Output:  
Background Image:
Example:
 <style>
   body{
       background-image: url("https://i.pinimg.com/236x/3d/61/3c/3d613ca5408e148f40bffdcaa8206dc1.jpg");      
      }
    </style>

Output:  


Background-Repeat:
 
  <style>
      body{
          background-image: url("https://i.pinimg.com/236x/3d/61/3c/3d613ca5408e148f40bffdcaa8206dc1.jpg");  
            background-repeat: no-repeat;    
           }
    </style>



Output: