Techcss
Untitled Document

CSS Background

Styling background of elements using CSS are very interesting tricks.

Background of any element is associated with color and image attribute. But using the CSS with image attribute is more tricky and multiple ways are there to display.

The background attributes of all elements are

  1. background-attachment
  2. background-color
  3. background-image
  4. background-position
  5. background-repeat

Controlling the background color attribute

Example:
    body {background-color:#BBE8C1;}
    div {background-color:#669900;}
    h2 {background-color:#b0c4de;}
    p {background-color:#669966;}
    
Output:

This is heading with background

This is a paragraph with background color.