Cascading Style Sheets (CSS): CSS 2.1 Primer
- Introduction
- CSS Rules
- Length, Percentage, Color and URLs
- Font Properties
- Color and Background Properties
- Text Properties
- Box Model
- Positioning and Display
- Lists and Tables
- The Cascade and Specificity
Overview
This primer delivers a clear, example-driven introduction to CSS grounded in the CSS 2.1 specification. It focuses on the fundamentals you need to move from inline or ad-hoc styling to maintainable, stylesheet-driven design. Concise explanations and practical examples show how rules are written and applied, how the cascade and specificity determine which declarations win, and how the box model, positioning, and display properties shape document flow and layout.
What you will learn
Work through this primer to build a dependable foundation in core CSS concepts and hands-on techniques. Key learning outcomes include:
- Reading and composing CSS rules: selectors, combinators, declarations, and property syntax.
- How the cascade, specificity, and source order interact to resolve conflicting styles in real-world pages.
- Managing units, color notations, and asset references for backgrounds and media.
- Typography essentials—font stacks, sizing, weight, and line-height—to improve readability and hierarchy.
- Using the box model effectively to control spacing with content, padding, border, and margin.
- Techniques for positioning and display to manage flow, stacking context, and element visibility.
Practical value and use cases
The primer is designed for immediate application: implement consistent site-wide styling with external stylesheets, stabilize layout behavior across browsers, and enhance legibility through considered typographic choices. Examples are mapped to common tasks—styling navigation, forms, tables, lists, and content blocks—so you can apply the lessons directly to live projects and debugging workflows using developer tools.
Who should read this
Ideal for beginners and intermediate front-end developers, web designers, and students who need a solid foundation before adopting modern layout systems such as Flexbox and Grid. It also serves as a compact refresher for instructors and experienced developers who want to reinforce the foundational principles that support responsive, accessible, and maintainable styling. According to the primer's author, practicing these basics reduces surprises when you move to newer CSS modules.
How to study this primer
Study the chapters in sequence to build a reliable mental model: begin with rule structure and selectors, then practice specificity and cascade interactions, and finish with layout and typographic techniques. Complement reading with hands-on experiments in a code editor and your browser’s dev tools—tweak selectors, adjust box-model values, and toggle positioning to observe real-time effects. Short, repeatable exercises and a property glossary help transfer concepts into practical skills.
Suggested projects to apply concepts
Turn theory into skill with focused projects that reinforce core ideas:
- Create a single-page portfolio using a shared external stylesheet, consistent font stacks, and a restrained color palette to practice global organization and inheritance.
- Build a small multipage website to observe cascading and specificity across components and templates.
- Design a typographic showcase that experiments with font-weight, line-height, and shorthand font declarations to improve readability and rhythm.
- Style a complex form or responsive navigation menu to practice positioning, display behavior, and accessible focus states.
Key takeaways
- Master the cascade and specificity to predict which rules apply and reduce style conflicts.
- Use the box model intentionally to control spacing and layout across different viewports.
- Prioritize typographic and color choices to improve readability and accessibility for diverse users.
- Organize styles in external, well-structured stylesheets to improve maintainability, reusability, and collaboration.
Next steps
After consolidating CSS 2.1 fundamentals, progressively adopt modern layout techniques—Flexbox, Grid, and media queries—while keeping accessibility and performance in mind. Apply the primer’s lessons on live pages, iterate on the suggested projects, and use browser dev tools to test and refine styles for confident, maintainable results.
Safe & secure download • No registration required