Interview Questions

How can I specify background images?

CSS Interview Questions and Questions


(Continued from previous question...)

32. How can I specify background images?

With CSS, you can suggest a background image (and a background color, for those not using your image) with the background property. Here is an example:

body {
background: white url(example.gif) ;
color: black ;
}
If you specify a background image, you should also specify text, link, and background colors since the reader's default colors may not provide adequate contrast against your background image. The background color may be used by those not using your background image. Authors should not rely on the specified background image since browsers allow their users to disable image loading or to override document-specified backgrounds.

(Continued on next question...)

Other Interview Questions