Seasonal Savings: 20% off selected memberships for a limited time. Give now

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

Creating a new CSS rule

From: Dreamweaver CS6 Essential Training

Video: Creating a new CSS rule

The CSS Styles panel can help control every phase of creating and managing CSS within Dreamweaver. In this movie I want to begin exploring how you can use the CSS Styles panel to create a new CSS rule. To do that we're going to keep working in the index file, but this time I have it opened from the 06_03 directory, and if I scroll down into my content, I can see these little section boxes, these info boxes. The headline doesn't look the way it should. It's just not styled at all to be quite honest with you. So we're going to focus on those and we're going to create a brand new rule that's going to target those elements.

Creating a new CSS rule

The CSS Styles panel can help control every phase of creating and managing CSS within Dreamweaver. In this movie I want to begin exploring how you can use the CSS Styles panel to create a new CSS rule. To do that we're going to keep working in the index file, but this time I have it opened from the 06_03 directory, and if I scroll down into my content, I can see these little section boxes, these info boxes. The headline doesn't look the way it should. It's just not styled at all to be quite honest with you. So we're going to focus on those and we're going to create a brand new rule that's going to target those elements.

Now to do that, we're going to go over to the CSS Styles panel and use the new rule feature. I noticed that if I look in the lower right-hand corner of the CSS Styles panel I have a series of icons over there. One of them that little chain like icon will allow me to Attach an External Style Sheet to a page, so if I create a brand new page from scratch and I want to go out and attach an External Style Sheet to it that's the icon I'll use for that. Though what we're interested in is the one right beside it, and this is a new CSS rule. You can see it looks like a little page with a plus (+) symbol on it. So anytime I want to create a new rule visually, I can just do that.

Now there's nothing wrong with going down there and clicking that icon and beginning to create your rule, but if you pay attention to where you're focused, both on the page and within the CSS Styles panel, you're going to do a much more efficient job of not only creating the proper selector to target the element on the page, but you're also going to be able to control where within your styles in terms of the organization of your styles, where this rule is going to be placed and both of those are very important things, especially as your pages get more complex. So in order to do that, what I'm going to do, I'm first going to click over here in Student Spotlight.

Now the first time you click on one of these info boxes, it's not going to select the individual element. You're going to get this blue outline around it because it's an element that Dreamweaver sees as a positioned element, so you're going to sort of get that overall group selection first. But if you double-click on that, that should take you into the elements inside of that, and I'm going to place my cursor directly inside the Student Spotlight headline. Now when I do that, I can see that this is an h2, so I know I need to target now a heading2 tag, and I see that it's inside of this section element.

And the section element actually has several classes applied to it, Spotlight, Info, and Condense. Now when I click on each of these as well, I can see that the classes they have applied to them are Events, Info, and Condense. Now Condense is basically controlling the transition, the animation of these things, when you hover over them they'll expand and we'll be covering that a little bit later in the title. So the only other class that allows me to target all of these at once is Info, so we need to somehow combine this h2 with the Section Info class and what we're going to do that is we created our new rule.

So now that I have some idea as to what the selector that I'm going to be creating needs to look like, I'm going to go over to the CSS Styles panel and I'm going to scroll through, to see if there's a location within my styles already that would be appropriate for our new rule. And I happened to notice as I'm scrolling down through here, I do have a whole series of selectors that are targeting elements within those info sections, so that's a perfect place for my new rule. So in order to make sure that the rule is placed in the proper location, what I'm going to do is I'm going to go up and I'm first going to highlight the section.info rule.

Now, I'm not going to double-click on that, I'm just going to click on it one time, and when I do that it's going to highlight it, and that essentially establishes the focus. So I've got really focus in two places right now. On the actual html page I have focus on the Student Spotlight headline, and in the CSS Styles panel I have my focus on the section.info rule. Okay, so now when I go down to the bottom of the CSS Styles panel and I click on the New CSS Rule icon, that's going to open up the New CSS Rule dialog box. This box essentially has three sections to it. The first one is what Type of Selector that you want to write.

The next is the actual selector itself, and then finally it asks where do you want to place these styles? Well, let's tackle these one at a time. For Selector Type, I can choose Class, ID, Tag or Compound. Class, ID and Tag allows me to create a single Class selector, ID selector, or Element selector, so if I want to target all h2s on a page, or everything with the class of Info applied to it, then those are the choices to use. If you want to be more specific however, you're going to create a compound selector, and essentially compound selector is allow you to type in as terms of a selector name, almost anything you want, but they're really focusing on doing what we call descendent selectors.

Now you'll notice that we get an immediate benefit by having our cursor inside the element. You'll notice that it tries to write the selector for us. It's doing spotlight.info.condense h2, so essentially it's saying, this particular selector would apply to any h2 that's found within an element that has all three of these classes applied to it. Well, I appreciate Dreamweaver for the effort here, but it didn't get it quite right. But that's okay, because I am now free to come in and modify this anyway that I want.

The first thing I want to do is I want to take the spotlight and I want to replace that. I want to make it so that instead of just spotlight, it's actually targeting a section tag, and then the condense really doesn't have anything to do with those headlines. There are certainly going to be some info boxes that don't animate, so I want to get rid of that. So I want to modify the selector to say section.info h2. Now this illustrates, for you guys that are new to CSS and you're wondering Do I need to learn syntax? Do I really need to learn CSS? This illustrates that yes, indeed you do.

So even though Dreamweaver does its level best to assist you in writing the selectors and to be honest with you, it's going to do a really good job most of the time, especially if you have fairly simple pages. There are going to be times when you have to go in there and edit that manually, so that you're targeting the proper element on the page. And the only way to be able to do that is if you understand CSS syntax and you know how to write these selectors. The next thing that I want to choose is where I want this rule defined and in this case I want it defined in my external main.css file. The only other choices that we have here is within this document that would create in embedded style in the head of the document, or if we wanted to create a brand-new style sheet file, which we don't, we want to leave that in main.css.

Okay, so those are your options for the New CSS Rule dialog box. Now once the rule has been created, you need to define the properties and the values for that rule, that's what we're going to do next. Since that process deserves a much closer look, we're going to explore setting Rule Properties to the Rule Definition dialog box in our next movie, and since we're going to be picking up from right where we left off, you don't necessarily need to even close the screen you have up right now. When this movie finishes, just go ahead and start the next one, stay right where you are at and we'll pick it up from this exact location.

Show transcript

This video is part of

Image for Dreamweaver CS6 Essential Training
Dreamweaver CS6 Essential Training

90 video lessons · 56520 viewers

James Williamson
Author

 
Expand all | Collapse all
  1. 1m 4s
    1. What is Dreamweaver?
      1m 4s
  2. 5m 44s
    1. Welcome
      1m 4s
    2. Using the exercise files
      2m 17s
    3. Learning web design
      2m 23s
  3. 1h 0m
    1. Looking at the Welcome screen
      5m 9s
    2. Exploring Windows and Mac interface differences
      5m 6s
    3. Arranging panels
      8m 44s
    4. Managing workspaces
      10m 14s
    5. Exploring the Application toolbar
      6m 21s
    6. Exploring the Document toolbar
      8m 47s
    7. Working with the Property inspector
      9m 30s
    8. Using the Insert panel
      6m 30s
  4. 53m 3s
    1. Understanding basic site structure
      3m 46s
    2. Exploring file naming conventions
      2m 10s
    3. Defining a new site
      5m 23s
    4. Managing files and folders
      7m 57s
    5. Adding remote servers
      7m 4s
    6. Uploading files
      12m 46s
    7. Previewing in browsers
      9m 11s
    8. Managing multiple sites
      4m 46s
  5. 36m 41s
    1. Creating new documents
      6m 49s
    2. Setting up new document preferences
      5m 30s
    3. Setting accessibility preferences
      6m 49s
    4. Working with starter pages
      4m 32s
    5. Managing starter pages
      13m 1s
  6. 37m 23s
    1. Getting text into Dreamweaver
      8m 43s
    2. Importing Word documents
      4m 6s
    3. Adding structure to text
      7m 35s
    4. Creating lists
      4m 35s
    5. Creating definition lists
      4m 0s
    6. Using the Quick Tag Editor
      8m 24s
  7. 44m 41s
    1. Exploring the Code toolbar
      5m 41s
    2. Setting code preferences
      7m 19s
    3. Using code hints
      8m 8s
    4. Wrapping tags
      5m 7s
    5. Adding comments
      6m 29s
    6. Using snippets
      7m 32s
    7. Formatting source code
      4m 25s
  8. 1h 19m
    1. Setting CSS preferences
      9m 32s
    2. An overview of the CSS Styles panel
      9m 23s
    3. Creating a new CSS rule
      6m 42s
    4. Using the CSS Rule Definition dialog
      7m 25s
    5. Organizing styles
      7m 22s
    6. Modifying style properties
      6m 17s
    7. Controlling CSS through the Property inspector
      6m 37s
    8. Attaching external style sheets
      5m 54s
    9. Using CSS visual aids
      7m 3s
    10. Using CSS Inspect
      6m 48s
    11. Using the Code Navigator
      6m 39s
  9. 1h 11m
    1. Managing assets in Dreamweaver
      7m 30s
    2. Setting external image editing preferences
      4m 26s
    3. Placing images on the page
      10m 12s
    4. Exploring Photoshop integration
      7m 17s
    5. Modifying Smart Objects
      9m 42s
    6. Modifying image properties
      8m 4s
    7. Styling images with CSS
      6m 45s
    8. Using background graphics
      7m 28s
    9. Positioning background graphics
      10m 10s
  10. 36m 23s
    1. Link basics
      3m 17s
    2. Setting site linking preferences
      2m 19s
    3. Creating links in Dreamweaver
      9m 17s
    4. Using absolute links
      3m 43s
    5. Using named anchors
      6m 41s
    6. Creating an email link
      5m 25s
    7. Creating CSS-based rollovers
      5m 41s
  11. 44m 30s
    1. Reviewing table structure
      5m 20s
    2. Importing tabular data
      6m 46s
    3. Creating accessible tables
      6m 11s
    4. Exploring basic table styling
      9m 42s
    5. Styling alternate rows
      8m 57s
    6. Creating custom table borders
      7m 34s
  12. 59m 15s
    1. Understanding how forms work
      2m 45s
    2. Reviewing form design
      3m 44s
    3. Creating accessible forms
      5m 16s
    4. Setting form properties
      2m 39s
    5. Using the fieldset and legend tags
      2m 52s
    6. Inserting text fields
      6m 56s
    7. Inserting list menu items
      7m 54s
    8. Inserting checkboxes
      4m 14s
    9. Inserting radio button groups
      3m 52s
    10. Inserting submit buttons
      2m 25s
    11. Exploring basic form styling
      8m 2s
    12. Exploring form element styling
      8m 36s
  13. 33m 25s
    1. Adding CSS3 transitions
      8m 29s
    2. Spry overview
      2m 44s
    3. Using Spry widgets
      3m 57s
    4. Adding Spry effects
      8m 1s
    5. Using the Widget Browser
      7m 4s
    6. Extending Dreamweaver
      3m 10s
  14. 1m 2s
    1. Additional resources
      1m 2s

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 Essential Training.

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.

Learn more, save more. Upgrade today!

Get our Annual Premium Membership at our best savings yet.

Upgrade to our Annual Premium Membership today and get even more value from your lynda.com subscription:

“In a way, I feel like you are rooting for me. Like you are really invested in my experience, and want me to get as much out of these courses as possible this is the best place to start on your journey to learning new material.”— Nadine H.

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.