View video tutorial

CSS Background

CSS

The CSS background attribute is used to add background effects to elements.

CSS background

➔ Background colors and background images are used in the following sections..

➔ The CSS background property is used to set the background effect on the element.

➔ The following are CSS background properties that affect HTML elements.

  • background-color
  • background-image
  • background-repeat
  • background-attachment
  • background-position
  • background (shorthand property)

Example

<!DOCTYPE html>
<html lang="en">
<head>
  <title>CSS Bangladesh Example</title>
</head>
<body>
  <div style=" background:#BEC2C4;border-radius: 5px; padding:10px;">
    <p>The CSS background property is used to set the background effect on the element.</p>
    <p>The following are CSS background properties that affect HTML elements.</p>
  </div>
</body>
</html>
Try it Now »