New Feature: Playlist Center! Pick a topic and let our playlists guide the way.

Start learning with our library of video tutorials taught by experts. Get started

CSS: Core Concepts
Illustration by

Resolving conflicts: Lab


From:

CSS: Core Concepts

with James Williamson

Video: Resolving conflicts: Lab

So now that we've taken a look at all the different concepts involving style conflicts, it's time for our resolving conflicts lab. Now in this lab I want to test your ability to resolve the conflicts through using the cascade, inheritance, and specificity. Just like the previous lab, there are several different ways that you could accomplish our goals, so while concentrating on how to solve the problems, be sure to think about how the solutions are coming up with works within the overall structure of the site's styles.
Expand all | Collapse all
  1. 4m 57s
    1. Welcome
      55s
    2. Using the exercise files
      4m 2s
  2. 1h 7m
    1. Exploring default styling
      4m 56s
    2. CSS authoring tools
      2m 29s
    3. CSS syntax
      4m 45s
    4. Writing a selector
      4m 10s
    5. Setting properties
      8m 40s
    6. Common units of measurement
      7m 47s
    7. Inline styles
      5m 1s
    8. Embedded styles
      5m 19s
    9. Using external style sheets
      10m 34s
    10. Checking for browser support
      8m 48s
    11. Dealing with browser inconsistencies
      5m 30s
  3. 2h 15m
    1. Structuring HTML correctly
      2m 51s
    2. Element selectors
      4m 52s
    3. Class selectors
      6m 4s
    4. ID selectors
      3m 27s
    5. Using classes and IDs
      10m 7s
    6. Element-specific selectors
      4m 35s
    7. The universal selector
      5m 42s
    8. Grouping selectors
      4m 49s
    9. Descendent selectors
      7m 32s
    10. Child selectors
      5m 7s
    11. Adjacent selectors
      5m 30s
    12. Attribute selectors
      12m 43s
    13. Pseudo-class selectors
      3m 54s
    14. Dynamic pseudo-class selectors
      8m 29s
    15. Structural pseudo-class selectors
      6m 45s
    16. Nth-child selectors
      13m 10s
    17. Pseudo-element selectors
      12m 40s
    18. Targeting page content: Lab
      8m 56s
    19. Targeting page content: Solution
      7m 59s
  4. 42m 39s
    1. What happens when styles conflict?
      4m 0s
    2. Understanding the cascade
      5m 47s
    3. Using inheritance
      6m 11s
    4. Selector specificity
      6m 55s
    5. The !important declaration
      4m 5s
    6. Reducing conflicts through planning
      3m 33s
    7. Resolving conflicts: Lab
      6m 45s
    8. Resolving conflicts: Solution
      5m 23s
  5. 1h 47m
    1. Setting a font family
      7m 10s
    2. Using @font-face
      9m 18s
    3. Setting font size
      7m 35s
    4. Font style and font weight
      6m 52s
    5. Transforming text
      3m 58s
    6. Using text variants
      2m 49s
    7. Text decoration options
      4m 26s
    8. Setting text color
      3m 2s
    9. Writing font shorthand notation
      8m 49s
    10. Controlling text alignment
      6m 33s
    11. Letter and word spacing
      9m 11s
    12. Indenting text
      4m 30s
    13. Adjusting paragraph line height
      10m 30s
    14. Controlling the space between elements
      6m 41s
    15. Basic text formatting: Lab
      8m 45s
    16. Basic text formatting: Solution
      7m 14s
  6. 2h 1m
    1. Understanding the box model
      16m 53s
    2. Controlling element spacing
      14m 29s
    3. Controlling interior spacing
      10m 49s
    4. Margin and padding shorthand notation
      6m 27s
    5. Adding borders
      8m 57s
    6. Defining element size
      10m 7s
    7. Creating rounded corners
      6m 58s
    8. Background properties
      2m 51s
    9. Using background images
      5m 10s
    10. Controlling image positioning
      10m 25s
    11. Using multiple backgrounds
      7m 5s
    12. Background shorthand notation
      5m 25s
    13. Styling container elements: Lab
      7m 55s
    14. Styling container elements: Solution
      8m 17s
  7. 47m 51s
    1. Color keyword definitions
      5m 4s
    2. Understanding hexadecimal notation
      6m 5s
    3. Using RGB values
      4m 58s
    4. Using HSL values
      5m 17s
    5. Working with opacity
      2m 23s
    6. Using RGBa and HSLa
      3m 8s
    7. Styling drop shadows
      5m 38s
    8. CSS gradients
      6m 32s
    9. Working with color: Lab
      4m 26s
    10. Working with color: Solution
      4m 20s
  8. 1m 58s
    1. Additional resources
      1m 58s

Watch this entire course now—plus get access to every course in the library. Each course includes high-quality videos taught by expert instructors.

Become a member
please wait ...
CSS: Core Concepts
8h 49m Beginner Nov 22, 2011

Viewers: in countries Watching now:

In this hands-on course, James Williamson demonstrates the concepts that form the foundation of Cascading Style Sheets (CSS), including styling text, adding margins and padding, and controlling how images display. The course also explores the tools needed to work with CSS, the differences between embedded and external styles, how to use selectors to target elements, and what to do when styles conflict.

Topics include:
  • Exploring default styling
  • Writing a selector
  • Setting properties
  • Working with common units of measurement, including ems and pixels
  • Structuring HTML correctly
  • Understanding the cascade and inheritance
  • Setting a font family, font size, text color, and more
  • Understanding the box model
  • Styling container elements
  • Working with RGB vs. HSL values
  • Styling drop shadows
Subject:
Web
Software:
CSS
Author:
James Williamson

Resolving conflicts: Lab

So now that we've taken a look at all the different concepts involving style conflicts, it's time for our resolving conflicts lab. Now in this lab I want to test your ability to resolve the conflicts through using the cascade, inheritance, and specificity. Just like the previous lab, there are several different ways that you could accomplish our goals, so while concentrating on how to solve the problems, be sure to think about how the solutions are coming up with works within the overall structure of the site's styles.

You want to make sure you're also doing it in the most efficient way possible. So from the 03_07 directory, I have the galleries.htm file opened and the main.CSS opened that's located in the _CSS folder in the same directory. Okay, it's the same site that we worked at in our last lab. If I preview this in a browser, you can see this time we're just kind of playing around with the galleries page. There are some things going on here that I want to change. I am not happy with the paragraph styling over here. The styling here is obviously wrong. We're having some styling conflicts here within the headers of this page.

So there are some things that we need to clean up and that we need to change based on some style conflicts that are occurring. Okay, I'm going to go back into our code. Again it's very helpful if you review the structure of the page. We have at the very top a page header with an ID of page header. We have a nav with an ID of main nav. That's followed by a section called content. In this case, the article that follows directly inside of section has an ID of galleries. We have interior sections with their own classes applied to them. After the article, we have the aside, which is our sidebar. It has its own nav inside of it, a couple of sections inside of that, and then finally our footer.

So be aware of that structure. Review that structure as you're reviewing the goals for this lab. Now I'm going to switch over to main.css, and one of the biggest changes in this lab compared to the previous lab is that in the previous you went ahead and wrote all your selector in sort of one location, right down at the bottom of the page. But if I scroll down to the bottom of these styles, I find that although we have some instructions down here, this is not the locations that these selectors will need to be. You're going to need to find out where in the selectors, where in the styles themselves, the rules that you're about to write are going to be written. Some might need to be embedded styles, some might be in this external style sheet, some might need to be inline styles.

If you paid attention to last movie where I talked about structure, you might know what my opinion of using embedded styles and inline styles are relating to an entire site, but that might be your decision. So what I want you to do is we're going to go through these one by one, but really you're going to have to understand the structure of our styles as well. So take some time. Go through our styles. Take a look at how they're organized. You know again we have our global styles at top. They are followed by our basic layout styles. Those are followed by constant region styles. And if you take a look at these content regions, you know the header cells show up first. Then we have our navigation styles. Those are followed by our banner styles.

These are actually more or less in the same order of structure that you'll find the page in, and I do that on purpose. Number one it makes them easier to find, and number two, in terms of the cascade, they really help make sure that the styles that you're writing are applied after elements that have come before it. Okay, so you have to determine exactly where to place these selectors or which selectors to modify. Let's go take a look at what we have to write. So the first thing that I want you to do is, these properties, and you can copy and paste these properties and put them inside of the selector that you write, but these properties need to be applied to every element on the page as their default styling.

So you want to make sure that those properties are applied to every single element on the page just as their default styles. That's not the saying they might not be overwritten later on. I just want them to start out as the default styles. The second task is to browse up to line 244--we will do that in just a moment--and view the article styles section. These selectors are conflicting with the page-specific main content styles below them and preventing some of the formatting from those rules from being applied.

Modify the selectors in this section to resolve this conflict. So if I go up to line 244, I can see that here are my article styles. So I have a whole section of article styles, and then below them I have these page-specific styles. Now we're on the galleries page, so that's really what you should probably be paying attention to, but what is happening is these selectors, which are supposed to be sort more global, are actually overriding these selectors, which are page-specific and should be overriding the generic article styles when they're applicable.

So that's not happening right now. You'll need to figure out why that's not happening, and you'll need to modify the selectors in order to make that happen. For the third one, we've got some properties down here that need to be included in a rule that targets the heading 2s on the gallery page only. So remember what we said about area- specific styles, these page-specific styles. So here we have some selectors that are targeting individual page content. You need to take a look at the structure of the selectors and figure out how to structure your own selector to make sure that these properties are only being applied to heading 2s on the gallery page.

And then finally, we need to take these properties and write a rule that changes the paragraph formatting for the text in the page sidebar. Now remember, the page sidebar is that aside. We'll go and take a look at that in just a moment. You should be careful to make sure the rule is written so that it overwrites previous paragraph styling and limits the styling to the contest sections. So within our sidebar we have our archive galleries, and then we have our contest sections. There's two of those. We want to make sure that these properties only write those paragraphs in those contest sections, and you can go up and find those aside styles around line 509.

Okay, so that's what your goals are. Now, I'll admit that this lab is a little bit tougher than our last one, and that's mainly because you're going to have to go in, analyze, and write new styles in a style sheet that you didn't write or organize yourself. Now this could be quite a challenge, I totally understand that, but I'll be honest with you, it's not an uncommon task in the world of web design, so this is actually really good practice. Be sure to pay special attention to page structure and how these styles are organized as well. By going through the page structure carefully, you're going to have a better idea of how to solve the problems I've given you.

Okay, there you go. Have fun!

There are currently no FAQs about CSS: Core Concepts.

 
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.
Upgrade now


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 Upgrade now

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 CSS: Core Concepts.

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 preferencesfrom 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

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.