A Web developer always tries to create an impressive website. This is because, unless the website looks appealing, a user is not attracted towards the content of the website. To create attractive websites, Web developers use background images and color gradients.
Prior to Hypertext Markup Language (HTML) 4, the background of a Web page was set by using the bgcolor attribute of the BODY element. However, from HTML4 onwards, the background is controlled by using Cascading Style Sheet (CSS).
CSS not only helps in setting the background of an entire Web page, but also helps in adding different colors to the various elements of the Web page. For example, you can set the green color for the entire Web page and display the content of a paragraph in the orange base color. Therefore, by using different elements with different background colors, you can easily highlight various areas of a Web page, such as paragraphs and headings.
The new version of CSS, CSS3, allows you to set the color of a background on the basis of various color specifications, such as Red Green Blue (RGB) and Hue Saturation Lightness (HSL). It also enables you to set the transparency level of a color that has to be displayed in the background of an element.
Using CSS3, you can also use an image as the background of a website and specify how many times the image should be repeated.
A Web page should have a background that expresses the motto of the Web page.
It is important that background should have lighter color than the text written on it, to provide the better readability. Similarly, while creating a Web page for entertainment, the background should preferably have vibrant color.
CSS provides you various properties to set the background of a Web page. These properties are as follows.
You will learn all about the above properties (divided into separate tutorials) used to set background of a web page.