HTML and CSS Reference
In-Depth Information
FAQ
What if my images don't show?
The following are common reasons for images not displaying on a Web page:
Are your images really in the Web site folder? Use Windows Explorer to double-check.
Did you code the XTHML and CSS correctly? Check for common mistakes such as typing
scr instead of src and missing quotation marks.
Do your images have the exact file names that you have used in the background or src
attributes in your XHTML code? Attention to detail and consistency will be very helpful here.
Hints for naming image files:
Use all lowercase letters.
Do not use punctuation symbols and spaces.
Do not change the file extensions (should be .gif, .jpg, .jpeg, or .png).
Keep your file names short but descriptive.
i1.gif is probably too short
myimagewithmydogonmybirthday.gif is too long
dogbday.gif may be just about right
Background Images
Using the CSS background-color property to configure the background color of a
Web page was introduced in Chapter 3. The W3C recommends that Web developers use
the hexadecimal numeric value rather than the color name when setting a background
color. For example, the following CSS code configures the background of a Web page to
be a soft yellow:
body { background-color: #ffff99; }
In addition to a background color, you can also choose to use an image for the back-
ground of a Web page. Be careful not to choose an image that is too busy; it could
interfere with your text and graphics. Use the CSS background-image property to
configure a background image for a Web page. For example, the following CSS code
configures the background of a Web page to be the image background1.gif located in
the same folder as the Web page:
body { background-image: url(background1.gif); }
You can use a graphics application to create your own backgrounds or find a free back-
ground image on the Web.
Legacy Alert. If you work with Web pages created by others you may find that the
XHTML attributes bgcolor and background have been used to configure the page
instead of CSS properties. See Appendix A for more information on the <body> element
and these attributes.
 
Search WWH ::




Custom Search