In Part 1 of this series you created a background image that you could use to test out the selectors that you wrote. You will continue to use this image in this part. In Part 1, you also learned how to use keywords to position your background images. Specifically, I reviewed the following keywords:
toprightbottomleftcenterAlthough these values enable you to position your background images, they don't offer a great deal of variation when used on their own. This can be a little limiting. To use background images and to get the most out of them, you need to gain greater control over where you can place them—which is what I will show you in this part of the tutorial. After you have completed this part, you will be able to place your background images wherever you need them.
Note: If you haven't defined a site in Dreamweaver yet, do so now. If you need help defining a site, see "How to Define a Site in Dreamweaver" (TechNote 14028).
To begin, you will start to work with multiple keywords. Start by revisiting the positioned.html page you created in Part 1 of this series. Open that page in Dreamweaver. Switch to Code view and you will see your embedded CSS in the head section of the document.
Note: You are only using embedded CSS for ease of presentation in this tutorial. In a real-world scenario, you would externalize your CSS rules in a separate file. Doing this provides global control over your documents.
First, you will learn about combining keywords. You have already used the bottom keyword and you have used the right keyword. But what if you want your background image at the bottom right of your page? The following Captivate demo and steps demonstrate how to achieve this:
Follow these steps:
By using the combination of the bottom and right keywords, you have more flexibility over the placement of your background image. Try repeating the process you have just completed and change the keyword, enter background-position: top right; and preview your page again to check the results. You may need to refresh your browser to force the update. You can, of course, use any combination of keyword pairs to place your image where you would like it to be.
Although this provides you with greater flexibility to position background images, there is still a lot of the browser's window area that you can't place your image. This is where measurement values come into play. I review this technique in the next section.