What Are the Background Style Properties

Q

What Are the Background Style Properties? - CSS Tutorials - Page Layout and Background Image Design

✍: FYIcenter.com

A

There are 5 style properties that you can use to control the background of a HTML block tag:

  • background-color: Specifies the color of the background. It takes a color value or the keyword "transparent".
  • background-image: Specifies an image to be on the background. It takes a URL value or the keyword "none".
  • background-repeat: Specifies if the background image should be repeated or not, and how to repeat. It takes 4 possible keywords: "repeat", "repeat-x", "repeat-y", and "no-repeat".
  • background-attachment: Specifies how the background image should be attached to the content or the browser window. It takes 2 possible keywords: "scroll" and "fixed".
  • background-position: Specifies the initial position of the background image. It takes a pair of two values of percentages, length units, or key words.

Note that when HTML tags are nested, backgrounds of different tags become layers with the background of the most inner tag being the top layer.

2007-05-11, 4703👍, 0💬