There are many ways to select elements. Explore best practices and guidelines for usage.
- [Instructor] With so many ways to target HTML,…how do you know which selector to use?…Let's go over some guidelines for writing thoughtful…and efficient CSS.…Use type selectors when all or most instances…of an HTML element needs to be styled in the same way.…Use classes to select elements that are more specific,…reusable and flexible than type selectors.…The class name is the selector,…so the style can be applied to any element.…
Also, the same class can be used one or more times per page.…ID values can only be used once per page,…so stick to using them for unique styles and global elements…that are not repeated.…ID values need to be unique for another reason as well.…They can also be used for in-page linking.…Let's take a look at a sample…frequently asked questions page.…Adding an ID attribute to the element…and using the value in the link's href attribute,…will automatically take you to the matching element…on the page when you click on the link.…
A unique value is needed so the href attribute…doesn't try to match more than one element on the page.…
- Creating a CSS file
- Writing basic selectors
- Setting properties
- Using different typefaces and web-safe fonts
- Understanding cascading and inheritance
- Setting a font family, font size, text color, and more
- Understanding the box model
- Using the float property
Skill Level Beginner
1. Getting Started
2. CSS Core
- Mark as unwatched
- Mark all as unwatched
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.Cancel
Take notes with your new membership!
Type in the entry box, then click Enter to save your note.
1:30Press on any video thumbnail to jump immediately to the timecode shown.
Notes are saved with you account but can also be exported as plain text, MS Word, PDF, Google Doc, or Evernote.