Easy-to-follow video tutorials help you learn software, creative, and business skills.Become a member
Class styles are fun to create and to use in a webpage. But you need to use them sparingly and you need to use them because you have a reason for accentuating or defining an element differently inside of your document. Let's try creating one more class in this document. I have a definition list saying blue is the color of the sky. I would like that word to actually be blue. So I'm going to double-click it. Return down to my Properties Inspector. Make sure that my CSS button is selected because I'm creating styles. Click on the color, look through here, find the color I want. I'm going to use #06f.
And of course Dreamweaver being right on me says, I think you are trying to create a class style and I am, it has guessed correctly. I'm going to give this a simple and direct name, blue. And I want to define this in the document because my styles are embedded in the style tag, in the head tag of the document. I'm going to focus off the selection and that's exactly what I want it to look like. Let's scroll down to the bottom of the page. What if I want to style something in my table? How would that work? I'm simply going to put my I-beam into the second row, second column. Go down to the Properties Inspector. Click on the Targeted Rule dropdown menu. Remember our classes will appear at the bottom of this menu.
Scroll all the way down and there is my new blue class. And this looks a little different than what we have been doing so far. The way I can tell this is by looking at the Tag Inspector. Notice it says td.blue. I know that .blue means it's a class style. A style I can use many, many times on a page. But now it seems to be attached or related to an actual HTML tag. Let's look at this in Split view. This is very different. It does not add the span tag and the reason it does not add the span tag is I simply had my I-beam within a tag. So Dreamweaver made the assumption that anything within that tag would have this class or this style blue applied to it.
So let's scroll up to the top of our page and look at the word emphasis. Notice emphasis is just a part of the whole body text. It's just one word. It's not the whole thing. I didn't use my I- beam to indicate that's what I want to style. I actually made a specific selection. In that case, Dreamweaver adds the span tag. So there's two different ways we can apply the class to different elements inside of our HTML document. Let's go back out to Design view. I would like to try using blue somewhere else. I have this quotation mark and I think it needs to be styled a little bit differently. So I'm going to select the quotation mark, come down to my Properties Inspector, select the Targeted Rule dropdown menu and give it a style of blue. I'm not really sure if that's what I want. I think that the other style I created, the hiLite style, might be better. The hiLite style, just to remind you, is red and italicized.
I think what I'll do is go into Split view and put my I-beam in there so I can find it. I'm going to line up the quotation mark with the code so that they are side by side. And I see right here in the block quote that a class attribute has been added and the value is blue or the style is blue. And I want to change that to hiLite. I used camel humping to name that style. So I need to use it again. I need to type it exactly as it's named in the style sheet, hiLite.
Let's click on the Refresh button on the right side. Let's focus outside of the selection. Yeah, that looks a lot better. That's exactly what I want. So it's really easy to keep changing these and updating these and making them work. Let's click on the Design button to go back to Design view. There is one last place I can experiment and edit with my class styles. I'm going to double-click on the word bold, I can see that the style that I have or the class that I have attached to that is bold word. If I come over to my style sheet and scroll down, I see that the three class styles that I created are at the bottom because they were the last three styles I created and I decide that I want to change bold word a little bit.
So I'm going to select that style or that class. Scroll up to the top of my document, click on the color and go out and see if there's another color that I might think would be better. I'll try that peachy color again. This might be a good place to try it. Let me catch that one more time. There we go. Focus outside of my selection. Notice where ever that style is applied, it now has turned to that peachy pink color. I'm not really happy with that. I really did like it the way it was before.
So to undo that style, just use your Command+Z or Undo keys to do that. And I'm back to my original color #960. I'm going to focus outside the selection. That looks good. Preview it one ore time in my browser to get an overall view of this page. Save my HTML document, just to make sure there are no surprises in the browser. It's all looking just like I would like it to look. Close Firefox, go back into Dreamweaver, save one more time.
So that's a look at how to use embedded styles, how to create styles that are attached to HTML text, how to create class styles and the difference between the span tag and attaching a class style to an HTML tag.
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.