← Back to Week 2

January 14, 2026

Class Summary

Today's class covered CSS Selectors and styling techniques. No in-class coding activity - just lecture and Quiz 1.

Slides: CSS Selectors Presentation

CSS Selector Types

CSS Specificity & Cascade

Rule: If two rules apply, the more specific rule wins.

Best Practice: Be as general as you can, but as specific as you need to be.

Font Sizing Units

Best Practice: Use rem or em instead of px for accessibility.

Box Model & Display

Flexbox Layout

Ideal for centering elements and creating column layouts.

.container {
    display: flex;
    flex-wrap: wrap;
    justify-content: center;
}

.child {
    flex-grow: 1;
}

Note: Don't use Flexbox for simple stacking or spacing that browsers handle by default.

CSS Class Naming

Semantic Naming

Name classes by their purpose:

Modular Naming

Name classes by function, combine multiple:

BEM Schema

Pattern: block__element--modifier

<form class="form form--theme-xmas form--simple">
    <input class="form__input" type="text">
    <input class="form__submit form__submit--disabled" type="submit">
</form>