Easy-to-follow video tutorials help you learn software, creative, and business skills.Become a member

Applying multiple classes

From: Dreamweaver CS6 New Features

Video: Applying multiple classes

Applying multiple class attributes to elements is a very common task in web design. However, until CS6, we've never had a way to apply multiple classes to elements directly within the Dreamweaver interface. Thankfully, not only does CS6 add this capability, it also adds it across all areas of the interface, making it easy to do no matter how you like working with your CSS. So with the file that we're going to be working on here, the index.htm file, I've turned Style Rendering back on, but I'm looking at the file in Design View and not Live View and that's going to help me select the elements that I want to apply multiple classes to.

Applying multiple classes

Applying multiple class attributes to elements is a very common task in web design. However, until CS6, we've never had a way to apply multiple classes to elements directly within the Dreamweaver interface. Thankfully, not only does CS6 add this capability, it also adds it across all areas of the interface, making it easy to do no matter how you like working with your CSS. So with the file that we're going to be working on here, the index.htm file, I've turned Style Rendering back on, but I'm looking at the file in Design View and not Live View and that's going to help me select the elements that I want to apply multiple classes to.

Okay, so the first thing I'm going to do is I'm just going to scroll down a little bit, and there's this little region right below that sort of branding graphic called Student Spotlight and I want to focus on this. So I'm going to go ahead and click anywhere inside that region and I'll notice right down here in the Tag Selector I get section. I want to click on that so that I'm selecting the entire section itself. Okay, now some of you guys are going to be familiar with applying CSS styles to the Property Inspector, so I'm going to go ahead and start there. One of the things I'll notice is that if I go right down to the Properties Inspector and I can see right here I have a Targeted Rule.

If I grab that pulldown menu, I'll see the option to Apply Multiple Classes now right here at the bottom of it. So it's always going to be sort of at the bottom of whatever populated list you have here. Now if I click on that, that's going to bring up the Multiclass Selection dialog box, and this is the exact same dialog box that you're going to be looking at no matter where within the interface you're applying multiple classes. Now the first thing you're going to see is a list of all the available classes. Now these are classes that have been defined inside your CSS. So if you're working with a brand new CSS file that's totally empty, or if you haven't defined any classes yet, you're not going to see anything there.

Now of course, this is still an option because right down here where it says Type to specify undefined classes, you could simply say class1, and then space, class2, and you could just keep going and it will apply those multiple classes for you. Now I happen to have all of the classes up here that I need, so first thing I'm going to do is scroll down and find info, and I'm going to check that one. Then I'm going to scroll down and find spotlight, and I'm going to check that as well. Now when I click OK, I can see that the info class attribute has been applied and the spotlight class attribute has been applied, and of course the formatting updates to reflect that.

You can see that down here in the Tag Selector we can see section.info.spotlight. With it selected, I could also hit Ctrl+T, or Command+T on the Mac, to bring up the Code Editor and there you can see that we have our section class info, space, spotlight as well. So the Properties Inspector of course is not the only place that you can do this. The next thing I'm going to do is select Current Show, which is right there, and I'm going to do the same thing again. I'm going to use the Tag Selector to go down and select section. Okay, now the Tag Selector itself can apply these classes for you. Now if you have an element selected, you can right-click that element or Ctrl+Click that element directly in the document window, but it's actually a little bit easier, and probably a little bit more accurate, to do it right here in the Tag Selector.

So if I right-click or Ctrl+Click, the section tag right over here in the Status Bar, you'll notice that we have an option to Set Class and one of those options is going to be to Apply Multiple Classes. So again, if I click on this, I get to click to specify which classes I want to apply this to. Once again, I'm going to scroll down and find info, which is going to be consistent on all of these elements and then I'm going to scroll down a little bit more and find show. I'll click OK, and it'll apply those classes to that element. Now that right-clicking option that I just showed you, that also works in Code View.

So if you're in Code View and you right-click on a tag and choose Set Class, you'll be able to do that as well. But if you're in Code View, you're probably going to be hand-coding that. I just want to let you know that that is indeed an option. They really put it everywhere in the interface that you can apply a class, they went ahead and put it in there, so they were very thorough with that. All right! I'm going to click inside the Coming Events one right there. Again use the Tag Selector to select the parent section and it's also available to you directly from the menu. So if I go up to Format > CSS Styles, I can see right down there at the bottom, Apply Multiple Classes, I'm going to select that.

And for this, I'll select events and once again info, so it's consistent all the way through. I'll go ahead and click that and it applies that as well. And if I turn Live View on, I can see that now those three sections are styled exactly the way I want them to be styled, based upon those classes. Now there's still one more thing that I want to show you guys here. So I'm going to turn the Live View off and do a Save All very quickly, and if I scroll up to the very top of the page, I can see that I have a paragraph up here. That is a little confusing because it's sort of hidden, it doesn't look all that great. So I've got a couple of classes here that can help me out with that.

So I'm going to go up and open up my CSS Styles panel. Now because of the lack of space that I have here, I'm going to sort of minimize all the rest of my panels and I'm also going to grab that divider and make sure I can kind of see all the rules that are available to me here. So one of the things that you can do is you can use the CSS Styles panel to also apply multiple classes to an element. So if I go down to the Tag Selector, I'm going to click on the paragraph tag to make sure I've selected it and not any of the span tags inside of it. I can now go over to the CSS Styles panel and I can scroll through and find the selectors that I need.

I need .cf which is the clearfix, so I'm going to grab that, and then if I continue to scroll down, I can find the branding class as well. So I'm going to hold down the Ctrl key which will allow me to select noncontiguous items here. On the Mac you'll be holding down the Command key when you do that. You'll notice it has both of those classes highlighted, the .cf and the branding. Now if I right-click those, I have the Apply option and if I choose that, it's going to go ahead and apply both of those classes to my paragraph and give me the styling that I'm looking for.

So once again I can save this file, click on it in Live View, and I can now see that paragraph styled the way that I was wanting to, based on those multiple classes. So there you go! Not only does Adobe give us the ability to apply multiple classes in CS6, which is welcome enough, but they also give us a number of ways to do it as well, which means you should easily find a method that fits your own personal workflow.

Show transcript

This video is part of

Image for Dreamweaver CS6 New Features
Dreamweaver CS6 New Features

11 video lessons · 14458 viewers

James Williamson
Author

 

Start learning today

Get unlimited access to all courses for just $25/month.

Become a member
Sometimes @lynda teaches me how to use a program and sometimes Lynda.com changes my life forever. @JosefShutter
@lynda lynda.com is an absolute life saver when it comes to learning todays software. Definitely recommend it! #higherlearning @Michael_Caraway
@lynda The best thing online! Your database of courses is great! To the mark and very helpful. Thanks! @ru22more
Got to create something yesterday I never thought I could do. #thanks @lynda @Ngventurella
I really do love @lynda as a learning platform. Never stop learning and developing, it’s probably our greatest gift as a species! @soundslikedavid
@lynda just subscribed to lynda.com all I can say its brilliant join now trust me @ButchSamurai
@lynda is an awesome resource. The membership is priceless if you take advantage of it. @diabetic_techie
One of the best decision I made this year. Buy a 1yr subscription to @lynda @cybercaptive
guys lynda.com (@lynda) is the best. So far I’ve learned Java, principles of OO programming, and now learning about MS project @lucasmitchell
Signed back up to @lynda dot com. I’ve missed it!! Proper geeking out right now! #timetolearn #geek @JayGodbold
Share a link to this course

What are exercise files?

Exercise files are the same files the author uses in the course. Save time by downloading the author's files instead of setting up your own files, and learn by following along with the instructor.

Can I take this course without the exercise files?

Yes! If you decide you would like the exercise files later, you can upgrade to a premium account any time.

Become a member Download sample files See plans and pricing

Please wait... please wait ...
Upgrade to get access to exercise files.

Exercise files video

How to use exercise files.

Learn by watching, listening, and doing, Exercise files are the same files the author uses in the course, so you can download them and follow along Premium memberships include access to all exercise files in the library.


Exercise files

Exercise files video

How to use exercise files.

For additional information on downloading and using exercise files, watch our instructional video or read the instructions in the FAQ .

This course includes free exercise files, so you can practice while you watch the course. To access all the exercise files in our library, become a Premium Member.

Join now Already a member? Log in

Are you sure you want to mark all the videos in this course as unwatched?

This will not affect your course history, your reports, or your certificates of completion for this course.


Mark all as unwatched Cancel

Congratulations

You have completed Dreamweaver CS6 New Features.

Return to your organization's learning portal to continue training, or close this page.


OK
Become a member to add this course to a playlist

Join today and get unlimited access to the entire library of video courses—and create as many playlists as you like.

Get started

Already a member ?

Become a member to like this course.

Join today and get unlimited access to the entire library of video courses.

Get started

Already a member?

Exercise files

Learn by watching, listening, and doing! Exercise files are the same files the author uses in the course, so you can download them and follow along. Exercise files are available with all Premium memberships. Learn more

Get started

Already a Premium member?

Exercise files video

How to use exercise files.

Ask a question

Thanks for contacting us.
You’ll hear from our Customer Service team within 24 hours.

Please enter the text shown below:

The classic layout automatically defaults to the latest Flash Player.

To choose a different player, hold the cursor over your name at the top right of any lynda.com page and choose Site preferences from the dropdown menu.

Continue to classic layout Stay on new layout
Exercise files

Access exercise files from a button right under the course name.

Mark videos as unwatched

Remove icons showing you already watched videos if you want to start over.

Control your viewing experience

Make the video wide, narrow, full-screen, or pop the player out of the page into its own window.

Interactive transcripts

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.

Are you sure you want to delete this note?

No

Your file was successfully uploaded.

Thanks for signing up.

We’ll send you a confirmation email shortly.


Sign up and receive emails about lynda.com and our online training library:

Here’s our privacy policy with more details about how we handle your information.

Keep up with news, tips, and latest courses with emails from lynda.com.

Sign up and receive emails about lynda.com and our online training library:

Here’s our privacy policy with more details about how we handle your information.

   
submit Lightbox submit clicked
Terms and conditions of use

We've updated our terms and conditions (now called terms of service).Go
Review and accept our updated terms of service.