Free Trial

Safari Books Online is a digital library providing on-demand subscription access to thousands of learning resources.


  • Create BookmarkCreate Bookmark
  • Create Note or TagCreate Note or Tag
  • DownloadDownload
  • PrintPrint

Adding a background image

You’re almost there. What’s left? We still need to get the white “guarantee star” graphic into the paragraph and work on the border, which is a solid, black line. Let’s tackle the image first.

If you look in the “chapter10/lounge/images” folder, you’ll find a GIF image called “background.gif” that looks like this:

image with no caption

Now, you just need to get that image into your paragraph element, so you’ll be using an <img> element, right? Not so fast. If you’re adding an image to the background of an element, there is another way. Using CSS, you can add a background image to any element using the background-image property. Let’s give it a try and see how it works:

image with no caption
image with no caption

No, the background-image property has a very specific purpose, which is to set the background image of an element. It isn’t for placing images in a page – for that you definitely want to use the <img> element.


  

You are currently reading a PREVIEW of this book.

                                                                                        

Get instant access to over
$1 million worth of books and videos.

  

Start a Free Trial