Like the other design elements discussed in this lesson, you should use images sparingly when they support the theme you've already established. In Lesson 8, you learned how to add images to your Web pages and use HTML and style sheet properties to align them with your text. Figure 13.3 shows the difference that balance and diversity make to your overall Web page layout. Figure 13.3. Adding diversity to your graphical layout helps add interest.Caution
Background ImagesEarlier, you learned how to add background color to your pages, but sometimes you'll want to add an image to the background of your page. The most prolific example of a background image is the page border (see Figure 13.4). Figure 13.4. Use the background-image and margin style sheet properties to create a colored border on your Web page.Here's how the source code looks for that page: <!DOCTYPE html PUBLIC "-//W3C//DTD XHTML 1.0 Transitional//EN" "http://www.w3.org/TR/xhtml1/DTD/xhtml1- transitional.dtd"> <html xmlns="http://www.w3.org/1999/xhtml" xml:lang="en" lang="en"> <head> <title>Using a Background Image</title> <style type="text/css"> body {font-family:Trebuchet MS, Arial; color:black; font-size:14; background-image:url(images\background.gif); background-repeat:no repeat); background-position:left top; margin:10px,160px} h1 {font-family:Bookman Old Style, Times New Roman; color:#A00068; font-size:18; background:white} </style> </head> <body> <h1>Background Images can be Fun</h1> <p>I had to add a margin around this text or it would have begun inside the colored border area and defeated the purpose.</p> </body> </html> The background.gif image is the colored border background. It is a GIF file, which makes it small (only 5KB) so that it will load quickly. I made it in Paint Shop Pro by drawing a rectangle down the side of the page, as shown in Figure 13.5. Figure 13.5. The background.gif file was created in Paint Shop Pro.You've already seen how you can use style sheet properties to set the fonts and colors of the page, but look at the previous HTML source code for Figure 13.4 again to see that we've added four new style sheet properties for you to learn:
If I hadn't set the margin property, the text on my page would have overlapped my image, as shown in Figure 13.6. Figure 13.6. Without the margin property, text starts at the left edge of the page.Tip
In this lesson, you've learned:
|