Summary 3
“Chapter 2 - Styln’ With CSS”
Topic 1 - CSS Rule Naming Conventions
CSS rules are made up of two parts, the selector (which states the element) and the declaration (which is made up of the property and a value). Multiple declarations can be contained within a rule, and are separated by a semicolon; multiple selectors can also be grouped before the opening curly bracket. Multiple rules can also be applied to the same selector, and these more specific selectors are categorized into three groups; “contextual selectors”, “ID and class selectors”, and “attribute selectors”.
Topic 2 - IDs and Classes
IDs are used for a single specific element in a page, and a class can be used multiple times on various pages to specify style rules. An ID is only used once on a page and is used to quickly select and change a certain set of tags for that element. A class attribute is used in the HTML body tag and starts with a period, but it is important not to overuse classes because it can cause the CSS to become difficult to keep track of.
Topic 3 - Pseudo-Classes
There are two types of pseudo-classes, “UI (User Interface)” pseudo-classes apply when the user is interacting with the page, like when the cursor is hovering over a link. “Structural” pseudo-classes apply when the order of certain structural elements is being taken into account, like if an element is in a list or table. There are four link pseudo-classes - link, visited, hover, and active, and they must be put in that order.