Ready to watch this entire course?
Become a member and get unlimited access to the entire skills library of over 4,900 courses, including more Web and personalized recommendations.Start Your Free Trial Now
- View Offline
- Exporting graphics from Photoshop
- Positioning elements with CSS
- Using the Roundabout plug-in
- Activating the carousel callback
- Detecting the image in focus
- Adding the final touches
Skill Level Intermediate
Now in order to adjust the spacing issues we are having in the caption area with the stem touching the leaves and to add some style to the captions, we are going to add two new CSS rules. We are going to need to create some compound rules, We want to create rules to target h2s and paragraph tags specifically that are inside of the caption's id div. So what I am going to do here is get my cursor inside of the captions id, and I can see down here that Dreamweaver will tell me that my cursor is inside of a div with the captions id. With my cursor inside of that div, I am going to come up here and choose New CSS Rule.
From the menu, I am going to come down and choose Compound, and what Dreamweaver will do is write a specific CSS rule to target that particular div. So I am going to come down here and click Less Specific. I want to basically start my CSS rule with #captions. After captions, I am going to hit a space, type h2. I want to target only h2 tags that are inside of the captions id. Let's click OK. Under Type, for Font-Family, let's choose Georgia. For Font-size we will pick 32 pixels. For Font-weight we will choose normal. For the Color we are going to type in a custom color, #6d8824. Next, let's go to the Box settings.
Let's uncheck margin. For the Top we are going to set 0. This is going to make the h2 touch the very top of that container, and then it will actually keep the container from pushing down away from the leaves. Set 0 on the Right, 5 pixels on the Bottom, and 0 on the Left, and then click OK. Now we won't see these designs actually take effect until we have our captions injected into this caption area, but before we do that, let's come in and create our second rule. Compound rule > Less Specific. We want to do #captions space p. Let's click OK.
For paragraph tags inside of the caption, let's come down to Font. Let's choose Arial. I want these to be 14 pixels. For Color, we are going to pick a medium gray, so #444. Let's come over to the Box properties. For Margin, we are going to set 0 on the Top, 0 on the Right, 0 on the Bottom, and just 3 pixels on the Left. This will sort of optically align the paragraph tags with the headings. Then we will click OK. To see these, let's choose File > Save All, then File Preview in Browser.
Now back in our browser, I am going to click on one of the teapots to invoke the showCaption function. Now we can see right here, the stem is actually touching the underneath of the leaves. We see our h2 and paragraph tags being styled here as well, and each of the teapots that I clicked, the same contents getting injected in, and the styles are being applied to every single caption that's being assigned into the captions id. Now that we have all of our styles in place for the captions, in the next movie we will work on the creating the animation states for the captions.