Viewers: in countries Watching now:
A web site is just a web site unless it’s designed with a unique style. Creating a CSS Style Guide: Hands-On Training highlights the importance of a CSS style guide, which serves as an interface for the design team and a communication tool for the client. Laurie Burruss calls on her background as director of digital media at Pasadena City College and takes an informative, real–world approach to this topic. She shows how Dreamweaver CS4 can be used to develop a coherent site–wide emotion that boosts brand identity. The course culminates with building a working web style guide for professional use. Exercise files and a downloadable PDF quiz accompany the course.
Download the exercise files from the Exercise Files tab.
So far all the styles that we have created are associated with an HTML tag, but what if we want to create a style that we can use throughout the page that adds emphasis or punctuates something or brings a highlight to a certain feature on the page? Can we do that? Yes, this is called a class. A class is a type of style that you can use any where on your HTML page as many times as you want. So let's try making one. Let's select the word bold right here in the body paragraph and then let's go down to the Property Inspector.
Before we start this make sure that you have the CSS button selected. Remember we are not working on structure now; we are creating styles. So this button should be selected, CSS for cascading style sheets. So I want to make something that's bold. I'm going to click on the Bold button and the instant I do that, a dialog box comes up called New CSS Rule. This is a new dialog box and a new feature inside of Dreamweaver CS4. It's a great feature. I really like it. You cannot create or change your web page without Dreamweaver asking you, is this some sort of style? It makes a guess and a good guess that this is a class and it actually defines what a class can do. It is a style that can be applied anywhere throughout your HTML page and that's exactly what we want. So let's leave it there. If you click on the dropdown menu, you'll see there is lots of other kinds of styles that we can create, but class is the one we want. Dreamweaver made the correct guess.
The second, and a really important thing, is to name the class a meaningful name. Since this is the style that I want to use to bold or emphasize words, I'm going to call this boldWord. I'm using camel humping, boldWord. The last thing and this is very important, because you could have lots of style sheets and lots of places where you could save this, is where do you want this rule to be defined? At this point all of our styles are in the styles tag inside of the head tag of this HTML document. So we will select, as Dreamweaver guessed, This document only. Let's click on the button OK. I can see that it's bold, but I'd also like to change the color.
So while I have it already targeted with this rule, I can continue to style or design this rule. Let's go back over to Color and let's type in the number 960 and click on our Tab key. Now I'm happy with this. This is a color that I have picked from my header. It goes along with my color palette. If I focus out on to the document window, I can see how that style will appear inside of my HTML page. It looks really, really good.
Let's take a look to see what has happened here, what has this meant for our page and for our code. I'm going to reselect the word bold and you'll notice that now in the Tag Inspector we have a new tag that we haven't seen before. It says span.boldWord. Let me translate that for you. This is a span tag and it has a class or a style attached to it that's called boldWord. Down in the Properties Inspector, because we've selected this word it says this word has this style attach to it. And last but not least, let's look in Code view. Let's choose the Split button. Now we get a good look at this new tag.
If we select this, we can see the span tag. The way I like to think of a span tag is sort of like parenthesis. Anything within these two tags, the opening span tag and the closing span tag, will be affected by this class or this style. So let's look at that. Here is the opening tag, here is the class and the name of this style is boldWord and this needs to be in quotation marks, and the item being affected is between the opening and closing tags. Think of span is being like something you hold between your two hands. Let's click on Design view.
The other thing we need to take note of where has that style been added in our Styles panel. Well, we are doing all of our styles embedded in this style tag, let's scroll down. Since it's the last style that we've created, it shows up at the bottom of our Style panel. It is a little different than our other styles. What's so different about it? The period. The period here indicates that this is a class. So whenever you see a period in front of the name of the style, you can know that it is a custom style or it's a class.
So can I apply it to other things? Certainly, I can use this style again and again, if I want and I can remove this style. I always think it's important to know how to undo whatever you do. We don't always do things right at the first time. So if I were not focused on this page and I wanted to remove the style, I would double-click on the word, returned down to my Property Inspector, go to Targeted Rule, and when I click on this dropdown menu a number of choices appear. First of all I see the cascade, all of the tags that I have created so far.
I could make a new rule. I could make a new inline style. I can remove and I see the class that I have created. In this case, I would say I'm not happy with what I have done, I would like to remove this class, I want it to go back to the way it was and look like the rest of the words in body text. That takes the style off and now it looks just like it did before, but please notice up in your Styles panel boldWord still exists and if I click on it, it is still a style in my embedded styles. If I click on Code view and scroll to the top of my page where my styles exist and look at the bottom of my style tag, here is my closing style tag. Since boldWord was the last style added, the last class added, it appears.
So I've removed it from my document, but it still exists in my styles. If I'm never going to use this again, a good practice would be to clean this up and delete this style. I can do it inside of Code view by selecting the name of the class and all of the attributes and values associated with it, and then click on my Delete key or we can go back to Design view, come over to our Rules right here, I can select the word right here and notice that there is a trash can. I can delete this style by clicking on this trashcan. Either one works, you just need to do figure out your flow and how it should work for you.
So now I would like to reapply this style, because I know it still part of my styles and I can use it again. That's the whole point of classes that you can use them again and again to add an effect on your webpage and to accentuate some element. I am going to select the word bold, go over to my Properties Inspector, click on the dropdown menu for Targeted Rule, scroll all the way to the bottom and choose boldWord. As I have been saying all along, we can use a class style again and again.
So let's select another word. Let's select the word emphasis. It's up in our body paragraph. Go down to my Property Inspector. It says there is nothing attached to this, no style applied. Click on the dropdown menu, scroll all the way to the bottom where our classes appear and let's choose boldWord. Let's click anywhere outside of the word, and now you can see that we can apply this style or this class throughout this webpage as many times as we want.
It's really fun and it makes for an interesting page, especially if we use it effectively and sparingly. Now I have a quotation and I have some other areas that I really want to emphasize, but I want to style them in a different way. So I'm going to select the span tag right here and I would like this to be italicized and red. So I'm going down to my Property Inspector, keeping in mind that my CSS button is still selected. Click on the eye for Italic, it says no, no, no you can't do anything without telling us what you are doing and what kind of style this is.
Again, Dreamweaver guesses correctly. This is a class, something I'll apply more than one time. I'm going to put my I-beam into the Selector Name and I'm going to type hiLite using camel humping again. I want it to define in this document, because I'm using embedded styles and then I'll click OK. So as it's selected I can click out and see did the italicize style apply. Yes, it did, but it's not the correct color. So can I go back and change my mind and edit? Yes.
Let's select that again. And while it is selected and while we see the name of the style in the Targeted Rule, we can come over to the color and change that. Let's pick a nice red color, I'll pick this color right here C30, and deselect that selection. That looks good. I am using this hiLite to emphasize certain things like code in this page.
So I'm going to select class as well, because it's a piece of code and I have a real reason to use hLite. I want to draw your attention to the fact that these are tags or code for styling a page. Go down to the Targeted Rule, click on my dropdown menu and choose hiLite. Notice I have two choices now: boldWord or hiLite. Classes are great styles to use throughout your page to bring attention to certain features and to emphasize certain kinds of things going on in your page.
For bold and emphasis, I want to really be emphatic, but with the red italicized I want to use that wherever there are special code or special kinds of quotations inside my page. Now that we've made two class styles, let's take a look at how we can edit those and use those in other places in our web page.
There are currently no FAQs about Creating a CSS Style Guide: Hands-On Training.
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.