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's not familiar with CSS. So 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 use starter pages, nor am I suggesting that this is the preferred way of establishing site layout.
It does however offer somebody who's new to Web design a quick way to establish a solid site-wide layout, and it introduces new designers to the concept of controlling sites through external CSS files. So I want to go right back to what we were doing in the previous movie by using some starter pages. I have defined the 03_05 folder as the root folder for our site, and I am just going to go up to File and choose New. Once again this is going to take us back to this dialog box and I want to stay with the options that I chose in the previous movie; Page Type is going to be HTML, Layout is going to be this 2 column fixed, right sidebar header and footer.
I am going to do HTML5 for the DocType, but one change I am going to make is instead of Layout CSS in the head of the document I want to create a new file. So make sure that choice is Create a New File. Now don't worry about doing any of this Attach CSS file by just telling it to create a new file. First thing before you even open your page it's going to prompt you to create the CSS file and ask you where you want to save it. So I am going to go ahead and create this. And as a promised, Dreamweaver is first asking me, okay, as far as the CSS goes where do you want to put that? So within the 03_05 directory I am going to click the Create New Folder option and I am going to choose _css.
Almost all designers are going to store their CSS in a central location within the site. It makes it easier to find, it's a little bit easier to maintain your styles, and it's easier to link to those files throughout the site. Now once I create that folder I am going to open it up. So this is the folder that I am choosing, this is where I am going to place the file. And then you have to decide what you want to name this file. Now you could name it like layout.css, main.css. I am going to leave the name as it is; two column fixed right header (twoColFixRtHdr). It's very descriptive but probably on a larger project I would rename that to something that was a little bit more generic or a little bit more stated of its purpose like layout for example.
So I am going to save that, and just as before nothing really new here. We get a brand-new file, starter page, but this time if I look over in the Files panel, I can see there is my CSS folder and there is the new CSS file that we created. Now I am going to go up and save this file and I am going to save it in the 03_05 directory, I am going to save it as index.htm. Perfect! A couple of things here. In the previous movie the CSS was added to the head of the document. If I look in Code view, I can see right up here instead of a bunch of CSS, it simply has this one link which links out to the external file that we created, and it basically says, okay, this is a stylesheet and that's what we are going to use to style our pages.
So accessing that code and modifying it can sometimes be a little bit of a chore. So one of my favorite features in Dreamweaver, I actually love this, is the Related Files feature. You can find Related Files directly above the Document toolbar. You'll notice here I have Source Code and I have the twoColFixRtHdr.css. If I click on that, it's going to change to a split screen or even a Code view and I have access to all of the CSS code without having to go open that document up. So I can edit those styles, change them, save them, hand code them, directly here without having to open them up as a separate document, which is just awesome.
And I can switch back and forth between the HTML code from my file and the code for the CSS. That's really a neat feature. Now I am going to switch that back to Design view, because we are going to edit some styles, but we are going to edit them using the CSS Styles panel, which is a little bit easier in terms of editing if you're new to CSS and you're not familiar with the hand coding. Now rest assured, I have an entire chapter on CSS in terms of writing CSS, managing and modifying CSS through Dreamweaver. So this is not the only thing we are going to do.
I am going to do this relatively quickly. So I'll spend a lot more time within CSS in sort of explaining those things to you a little bit later on in another chapter. But for right now, I am going to open up the CSS Styles panel and then I am going to minimize the Files panel so that I have a little bit more room here. Now you may need to re-arrange your CSS Styles panel. I want to make sure I am looking at the All view and I want to arrange this divider here so that's pretty easy for me to find the styles that I am looking for. Now if your window just simply won't go that long, you can still scroll through your styles, but if you can sort of expand that so that you can see all of them at the same time, that's even more advantageous for you.
Before you start modifying styles, you want to know a little bit about the document that you're going to be working on in terms of how it's structured. One way to do that is simply to switch over to the Code. If you switch over the Code, you can go through and you can say, okay, first thing I see inside the body tag is a div tag with a class of container. Inside of that I have the class, div tag with a class of header, so there's my header. Then I have my sidebar and then if I go a little bit further down there is my content. Now if you are a person that really sort of enjoys the visual aspect of Dreamweaver, you can switch back to Design view and in here for example if I click inside the header.
If I look in the tag selector, which is this little area right down here on the Status bar, this is almost like a little breadcrumb navigation telling you where you are. Notice that currently, for example, I'm inside of a link tag which is inside of a div with a class of header, which is inside of div with a class of container, which is also inside the body tag. So every time I click in a different location, it tells me where I am. That's also going to help me determine which style to edit to change a specific item on the page. So our layout, it looks fine.
I am certainly going to replace the content. For example, I could come in here and change this headline from Instructions to Welcome to Roux Academy. But frankly, you're probably going to just simply delete all that placeholder content and replace it with your content. But you're free to modify those if you want. Currently, I'm more interested in sort of styling these container areas, because that's more sort of something that I need to do across the entire site. The colors in the site right now don't fit my branding. And in terms of the mockup that I did for the site, these regions aren't the right size either.
So if I click inside the header I'll start there, I can see that again it's a div with a class of header applied to it. So if I go over to the CSS Styles panel and I look through the styles, I can find right there .header. So that tells me which rule I need to edit in order to edit that region. So I am going to click on that and I can see that the only thing right now defined for that is background color. Well, I want to change that. So what I am going to do is I am going to click right here where the background color is and I am free to type in whatever I want. Now they are using hexadecimal notation.
I am going to use RGB notation which is just another way to denote color. So I am going to type in rgb and then open up parentheses and then I am going to type in 251, 174, 44. Close my parentheses (rgb(251,174,44)) and I am going to hit Return or Enter, and you'll notice that the header changes color. Now the little placeholder doesn't, but that's just a little placeholder graphic. That's really just designed for you to swap out your logo with it if you so desire or you can just delete and get rid of it.
You'll notice as soon as I deleted that all of a sudden the header got really small and that's because currently the height of the header is being driven by the content inside of it. Well, what if you want it to be a specifically designed height? Well, instead of just changing properties that you already have, using this view of the CSS Styles panel you can add some properties as well. So I am going to add a property and I am going to add height. If you're not sure what properties are available to you, you can grab the pulldown menu and you can sort of scroll through all of the available properties. So I am going to choose height.
And the height that I am going to set for this is 192 pixels. You can see as soon as I do that the header area gets a lot taller. Well, if I look at the container in the sidebar over here, again color scheme isn't quite right and also my sidebar needs to be a little bit wider, based on the mockup that I created, my sidebar needs to take up more room, because there is more relevant content inside of it I guess. I am not really sure, that's just the way I designed it. So clicking inside this content region, again I can see that I am inside of a div with a class of content.
So I am going to go over to my CSS, find content and select it and I can see that this is floating to the right, it's padding is 10 pixels top and bottom, 0 pixels left and right and its width is 780 pixels. I need to change that. So I am going to change it from 780 to 640 pixels. Now when I do that, probably you were thinking that it was going to shrink on left hand sort of, right? But this is floating to the right, so essentially this container, and you can see the outlines of the container here, Dreamweaver has given us a lot of information about this.
You can see that it just sort of shrunk it, but it created a bunch of empty space over here. So what I am going to do now is I am going to find my sidebar. When I click inside my sidebar, again that's a div tag with a class of .sidebar1. Okay, fair enough. So I am going to go up to find that rule, I am going to select that and I am going to change a couple of things here. One of the first things that I am going to do is I am going to change the background color. So with background color again I am going to replace this with RGB values. I am going to type in rgb(2,99,174).
If you are wondering, is it more advantageous to use one of these hexadecimal notations versus RGB, not really. When I click on that, I can see it changes again the background color of the sidebar to that blue color that I was wanting. And the next thing I am going to do here is change the width. So I am going to change the width from 180 pixels to 318 pixels and as soon as I do that, you can see now my sidebar is much wider and the content region over here sort of moves back over to its proper location. I am going to go ahead and Save All here.
And all we've really done so far is create one new page and sort of modify a few styles. That's hardly the basis of workflow for an entire site, but in reality by separating the CSS to this external file we've made it a lot easier for us to build a site around the choices that we've made. If I close this file and I go back to Dreamweaver and go to File>New, and I can go back through these choices again. I can say, hey, I want to create a new page in this time, but I want to base it off of the CSS that I just created and edited.
So again I can choose HTML, 2 column fixed, right sidebar, header and footer. That's going to give me the exact same structure as the index page that I just saved. But this time instead of creating a brand-new CSS file, I am going to tell it to link to an existing file. So now I can go ahead and attach that file, I am going to browse out into the 03_05 folder, find the CSS directory; select the (twoColFixRtHdr), click OK. Now it's going to show you something about a relative path. Don't worry about that. That's just because we haven't saved our HTML page yet.
I am going to click OK and Create. It creates a brand-new page for me, which I can then save. I am going to save this page. I'll save it in 03_05 directory. I'll save this one as about.htm, maybe this is our about page and I can replace this content. But what's awesome about this workflow is that all the changes that we made to our previous file in terms of the CSS are added to this one as well, because they're both linking to the exact same CSS file. So this workflow is a way to sort of initially take your CSS file from the starter page, modify it however you want, typography, layout, whatever you want to do, and then from there just keep using the same structure in terms of the starter pages, but link it to your custom CSS.
So it's kind of an efficient way to create a lot of pages that are going to use the exact same layout. Now the nice thing about this workflow is, for you guys that are newer Web designers, it's going to allow you to quickly establish a basic page structure and an external CSS file that can be used to control the entire site. Now the CSS that the starter pages add, it's very lightweight, can be modified as much as the site requires and it's also a great way for you guys to learn CSS, as you can experiment with the CSS to see how it affects multiple pages, add rules to the CSS to control additional elements within the page that you add a little bit later on. Of course there are other ways to achieve the exact same results, but this is one of the quickest and easiest ways for new users to adopt CSS layout.
Now of course, I have to note that in no way this lessens the need for you new designers out there to learn CSS as quickly as possible. CSS is used to control almost all modern websites and without understanding how CSS works and how to author it so that you can control your Web pages, what you can accomplish as a Web designer is going to be extremely limited.
Get unlimited access to all courses for just $25/month.Become a member