Easy-to-follow video tutorials help you learn software, creative, and business skills.Become a member
While starter pages can do a great job of giving new designers a head start on controlling page layout with CSS. They are, by nature, designed to be individual pages. Using the CSS within a starter page to control an entire site can be a bit of a challenge to somebody who is not familiar with CSS. In this movie, I want to show a workflow based on creating sites through starter pages. By no means is it the only way you starter pages, nor am I suggesting that this is the preferred way of establishing site layout.
It does, however, offer somebody new to Web design a way to quickly establish a solid site-wide layout and introduces new designers to the concepts of controlling sites through external styles. So the first thing I am going to do is create a brand-new page using one of Dreamweaver's starter pages. So I am going to File and choose New, and I am going to choose from a blank page HTML, and I want choose this 2 column fixed, left sidebar, header and footer. Now unlike we did in the last movie, this time I want to change where the Layout CSS is going to be located.
Instead of adding it to the head of the document, I want to place it in a new external cascading stylesheets file. Externalizing your CSS is a really great way of controlling your site, because now every single HTML page can link to that CSS file. And any change that you need to make to your site's typography, layout, colors, can be done by modifying a single file. So it's a really nice way of working. Okay, now I am going to choose Create and when I do that, because of the fact that I've told Dreamweaver to create a new file for the CSS, I'm going to be prompted to create a brand-new CSS file.
Now within my 04_05 folder, I am going to create a brand-new folder for my CSS. It's always a good idea to keep all of your styles in a single folder. So I am going to name this folder _CSS. The underscore identifies it as an asset folder instead of subdirectory and makes sure that it displays towards the top of any directory list. Now inside that, I am going to save this file, not as twoCol FixLtHdr, which is nice and descriptive, but I just want to call it main.css. Now, you are free to name your style sheets anything you want to name them.
I usually use main, because, well, it's the main styles of the page, but really, you can come up with your own naming conventions. You don't have to follow what I've done here. So I going to choose Save, and now I have my brand-new starter page - I am going to switch over to Design view - and it is being driven by this external style sheet. Now I can prove that by going over here to my CSS Styles panel, clicking on the All Styles and sure enough, there is my external main.css. So this time if I go into Code View, you'll notice that in the head of the document there are no styles whatsoever.
They are all in this external main.css, and you can click right up here in the document toolbar, and you could see they're all now been externalized in that one file and they are being linked to the page. Now if you're wondering how that works, notice that here in the source code of our HTML file, on line number six, we have this link, right here, that's linking to this file. Now this is a weird link right now, because it's pointing to some place on my computer instead of a document-relative link. The reason for that, we haven't saved our file yet, so let's go ahead and do that.
I am going to File and choose Save. I am going to save this into my root directory, and I am going to save it as index.htm. Now notice that that link tag resolves itself to something that's a little bit more manageable. Now, as I've mentioned before, you're free to tweak these layouts and do anything you want to them. So let's say that while we agreed that this is a great place to start, maybe it wasn't exactly the layout or the color scheme that we want. So what we are going to do is make some quick changes to our CSS to affect the width of the page, maybe width of some columns, things like that.
Now in order to do that, it's very important that you understand the structure of the page. And Dreamweaver can help you do that as well. Notice, for example, if I click inside this heading called Instructions, right down here underneath, our document window, we have what is known as the tag selector. Now if you've never used the tag selector before, I really want to encourage you to take a closer look at this. Your tag selector is going to tell you the structure of exactly the area that you are in. So for example, by clicking in here, I see that that I am inside of an H1 Tag, which is inside of a div with a class of content, which is inside another div with a class of container, which is inside the body tag.
Now if I click on Code View, I can see that very clearly. There is my div for content, there is a div for a sidebar, there is my container div, and there is my body tag. So there we were seeing the tag structure that the tag selector was telling us. Now why is that important? Well, if you don't understand what the name or the ID or the class of that element is, you won't know which rule in your CSS to change. Now we are going to be talking a lot more about CSS later in this title, so for right now, if some of this is confusing for you, that's okay.
We'll be talking a lot more about classes, IDs and these selectors as we go. Okay, so what I want to do is I want to change the overall width of my page, and the best way to do that is find the top level parent tag, which in this case is the div with the class of container, and then go find the selector that drives that. So I am going to go over to my CSS Styles panel. There it is right there, .container. Now if collapse my Files panel by double -clicking on the tab, I get to see all those properties currently for my container. Notice that right now the width is 960 pixels. Well, maybe I want it to be shorter than that, so I could click right here for the value, and just type in 920 pixels, and when I do that it shirks the page size down.
I also notice that I don't see my main content region anymore. Well, the reason for that is the main content region is now too wide to fit in this area. The width of the sidebar plus the width of the main content region need to add up till 920. So I am going to go and find that content region. Once again, I am going down the list of my selectors until I find content. I notice that the width given for this is 780 pixels. I am going to change that to 740. There we go. My content is back again. So now we have a much narrower page that fits what we want for our site.
We can continue to make changes here. For example, we could change color. We could change typography. We could change the width of the sidebar and the main content region so that the sidebar was a little wider, and it's entirely up to us. Okay, so I'm pretty happy with what we have done here. So I am just going to go ahead and do a Save All, and close my index file. Now once again, as I mentioned before, CSS starter pages are typically designed to be single pages, but what if we want to create an entirely new page for our site using all those modifications that we just made? Well, let's see how we would do that.
So I am going to go to File, and choose New. Once again, I am going to choose this 2 column fixed, left sidebar, header and footer. I can go ahead and click Create, but before I do that, I want to verify something. Notice, again, that Layout CSS is saying, "Okay, create the New file." Well, that wouldn't be very efficient. You'd be creating a new external stylesheet for every single page in your site. It's not really what you want to do. So instead of that option, I am just going to say Link to an existing file. After all, I want to use that style sheet that we just created.
Now when you do that, you have to go over here and tell Dreamweaver which stylesheet you want to use. Some sites have multiple stylesheets, so don't assume that it's just going to go ahead and pick up the stylesheet that you just did. So I am going to click that little link to Browse, and again, I am going to Browse out to the 04_05 CSS folder that we created earlier, choose main.css. And that little warning that you got is just Dreamweaver saying, "Hey, make sure you save this file." Next thing we are going to do is we are going to add that head of the document as a Link.
And we'll talk more about the difference between Link and Import in the later movies. For right now, we just want to use Link, so I'll click OK, and I'll click Create. Now I am going to go ahead and save this file, and I am going to save this as about.htm. Perfect. Now we are getting the proper width, and we're using the styles that we modified earlier. So we didn't have to create a whole new section of files, but because of the fact that we use the same starter page, the structure of HTML was the same, and that means that the styles we had earlier can drive this page. Now if I choose a one-column layout or a three-column layout, it probably wouldn't have been as effective because those styles are designed for this particular layout.
So if you are going to use a one column, a two column, and a three column within your site, you may need to have separate external style sheets to drive those. Now, I want to take just one last moment here and prove to you that those external styles are driving both pages. I am going to go right over here to our CSS Styles, and I'm going to choose the header selector. The header is this top region. I can see that I have background color for that, so I am going to highlight these hex values here, and I am going to change it to a different color, maybe one for more Explore California site.
So I am going to choose #193742. When I Return, I can see that the header is now sort of that dark blue. Now if I do a Save All, go over to my Files panel, and open up the index file, I can see that it's using that same exact blue color. So both of those are getting their layout, their color, their typography, all of that from that external stylesheet that we created when we first created our first starter page. Now this workflow is going to allow newer Web designers to quickly establish a basic page structure and an external CSS file that can be used to control the entire site.
The CSS is lightweight. It can be modified as much as the site requires. It's also a great way to learn CSS, as you can experiment with the styles to see how it affects multiple pages and add rules to the CSS to control additional elements within the page. Of course, there are other ways to achieve the same results, but this is one of the quickest and easiest ways for you new users to adopt. And one last thing: this in no way lessens the need for new designers to learn CSS as quickly as possible. CSS is used to control almost all modern Web sites, and without understanding how it works, and how to control it, your Web design skills will always be needlessly limited.
Get unlimited access to all courses for just $25/month.Become a member
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.
Your file was successfully uploaded.