Viewers: in countries Watching now:
Covering diverse topics such as improving workflow and managing CSS styles, Dreamweaver CS3 Beyond the Basics is a hands-on course that teaches users how to move beyond standard, static websites. Instructor James Williamson explores how to increase productivity, interactivity, and accessibility with Dreamweaver. He also discusses how to extend the application's capabilities with XML and XSL. Exercise files accompany the tutorials.
When working with CSS based layouts it's very easy to fall in the routine of having all of your elements inside of rectangular boxes. Now this can lead to layouts that seem rather stale. So our last background graphic technique will involve creating a rounded corners and let's take a look at the element on the page whose corners we are going to round. The Current Show content area right now is in a sort of darker tan rectangular box and while it's not unattractive it's not really lighting anything up rather. So we're going to round the corners and add a little bit of a shaded effect to the corners too to give it a little bit of added depth. One of the ways to achieve this is just to do a background graphic that is quite frankly a rounded rectangular box and put it behind the entire element. The problem with that is what happens if you are going to add more paragraphs to it. What happens if this content grows and all of the sudden your graphic doesn't fit the content. So we're going to use a nice little technique here that allows us to have content that can stretch vertically but still maintain those rounded corner edges and the trick to this technique is in actually looking at the structure of the element itself. So I am going to click inside the Current Show headline. So we're still working on our index_background Exercise File and I am going to switch over to Code View and in Code View we'll take a closer look at the current div tag. So if we scroll down a little bit so that we can see the whole thing. We see that we have a div with id of current. Inside that we have a heading 1, a heading 2 and then some paragraphs. Now I want you to pay particular attention to the last paragraph because it has a class style applied to it called last and we're going to use that to our advantage. Essentially what this technique allows us to do is will give one overall background graphic to the entire current div tag. We'll then take the Rounded Corner background graphic and apply to our first element which in this case is h2, then we'll take our second background graphic and apply it to the last element and in this case it's the paragraph with the class of last. Now that's what gives us the flexibility of having extra code in here or having a stretch vertically. All we need to do is make sure that the last paragraph or the last element always has that class style applied to it and with those rounded corners. Now before we actually go into the CSS of this, I thought it would be helpful to actually look at the images.
So you know what is being assembled. So we're going to jump over to Photoshop and take a quick look at those and then we'll come back in and work on the cascading style sheets. Here in Photoshop are the three background graphics. The top one notice is not very tall. It just contains the top rounded corners. The graphic in the middle is much taller than we think we're going to need it. We want to make that as tall as that content might ever be and that way as the content stretches down, we still have that background graphic. So it's good that taller than the actual content necessary. The bottom background graphic contains just the rounded corners on the bottom. So these three background graphics will be assembled into our current div element. Now back in Dreamweaver, I am going to switch over to our layout_background.css file again, so we can add some styles here. And since we're working with current we are going to need to find that area. And again since we structure the styles so that they are in the order they appear in our file, they are pretty easy to find. So right after favorites and we can find current and there it is. So the first thing we're going to do is we'll go ahead and apply the background graphic to the overall current div tag and after the existing margin, let's go ahead and add a new rule to our selector and we're just going to use background and once again, the only thing that this is going to have is URL. So I'll use the Browse feature that Dreamweaver gives me to go in the Images directory. And I am looking for the current_bg.gif file. That's the one we're just looking at and I'll choose that and Save our file. If I switch back to the index_background page and switch over to Design View we can see that we have now got that background graphic. Now it is definitely the same background color so we might need to preview that in the browser to accurately see those edges.
Let's go and preview that in the browser. And as I do that you can see on the very edges here we got a little bit of a shadow or little bit of definition and that's going to help to give it a little extra kick. So we'll close our browser and we'll go back into Dreamweaver and we'll work on adding our rounded corners. Now we already have selector for h1, so we don't necessarily need to add another selector. We just need to do another modification. So for the current h1 selector, I'll add a new line to that and I'll type in background again, and once again I'll type in the URL and we'll browse out to the current_top_bg. So current_top_bg.gif file and we'll choose that one. We need to remember to go ahead and give this some positioning. So we are going to tell it to no-repeat and we're going to tell it position top left. This is actually a really good idea no matter what background graphic, even if you want your background graphic to tile, telling it repeat is really not a bad idea because what that allows you to do is as you are reading through your code you know that hey I did want this background to tile. So I am actually going to go back up to our current one and where we didn't really specify anything up there.
I am actually just going to tell it to repeat along the Y axis. I don't need to give it any positioning information but I am going to repeat it along the Y axis. That way if for whatever reason the current even though it has a fixed width right now if they decide to stretch it later on it's still just going to repeat right on that Y axis and not tile horizontally. So that gives us our top rounded corners. We're going to go down to the very bottom of our current styles and there is current p now. We can't modify just the paragraph because it will give rounded corners to each paragraph. We need to do that in a class selector. So we're going to add a new rule here. So type in #current p.last.
What we're doing is we are doing a descendant selector that has the id of current and inside that it's looking for any paragraph with the class last applying to it. So are going to open a curly brace. That was going to be a pretty simple rule as well. We'll type in a background and we'll do URL and I am going to browse again and this time we're going to find the current_btm_bg. So current_btm_bg.gif. We we'll choose that one. As we did with our top line we will add a no-repeat to this. We really don't want this to tile at all and this time we're going to change the positioning. We are actually going to position it against the bottom left corner, bottom and then a space and then left. Now what that does is it takes the bottom left hand corner of the graphic and it aligns it to the bottom left hand corner of the element. That's really important so that our background graphic for the rounded corners on the bottom snaps down to the very, very bottom of the container element. And the last thing we are going to do is we'll add a little bit of padding and some margin.
So I'll go ahead and do a padding and I don't want padding all the way around. I just need padding on the bottom and what that will do is it will keep the paragraph content away from the background graphic so that your content doesn't run up over those corners. So let's say padding-bottom and we'll just do 2ems and that's about two lines over the space there. And the last thing we're going to do is we'll apply a margin of zero. It will go ahead and zero any margin that the paragraph has on the bottom of it. Because remember just above this in a current p selector if we are giving our paragraphs 1.2ems worth of top and bottom margin to space them out. Well, we don't want our last paragraph spaced out because that would push it even further away. So we'll go ahead and close our curly brace, save the file and when we switch back over to index_background. There is our rounded corners. So we'll preview that in our browser just to make sure everything is working properly and there you go.
Find answers to the most frequently asked questions about Dreamweaver CS3 Beyond the Basics .
Here are the FAQs that matched your search "" :
Sorry, there are no matches for your search "" —to search again, type in another word or phrase and click search.
Access exercise files from a button right under the course name.
Search within course videos and transcripts, and jump right to the results.
Remove icons showing you already watched videos if you want to start over.
Make the video wide, narrow, full-screen, or pop the player out of the page into its own window.
Click on text in the transcript to jump to that spot in the video. As the video plays, the relevant spot in the transcript will be highlighted.