Frontend is a free bonus on CodeMentor AI β the main product is Python. Register to save your progress and unlock all 290 Frontend lessons + 1,000+ Python lessons.Sign up β free
TaskOverride the default h1 size. Set body margin to 0, and h1 font-size to 48px with color #3B82F6.
Where styles come from: the three origins
50 XP6 minFREE
Theory
CSS isn't your stylesheet alone
Every element on a page has a "computed style" β the final answer the browser uses to paint it. That answer is the result of merging styles from THREE origins, in this priority order (lowest to highest):
- User-agent (browser defaults) β
<h1>is bold and 32px because Chrome says so.<a>is blue and underlined. Lists have bullets. Margins exist between paragraphs. - Author styles β your CSS files +
<style>blocks + inlinestyle=""attributes. - Inline styles (still author, but higher specificity).
- !important declarations cross-cut all of the above.
Plus a fourth origin you can ignore for now: user stylesheets β custom CSS the user can apply in browser settings (rare; mostly accessibility).
The "starts working from nothing" mistake
Junior devs often look at a default <h1> and wonder "why is this so big?" β they don't realize the browser already gave it 32px and margin. Modern projects ship a reset or normalize stylesheet first:
/* Modern minimal reset */
*, *::before, *::after { box-sizing: border-box; }
body { margin: 0; line-height: 1.5; }Two lines that solve 80% of "why does my hero have a tiny gap at the top?"
What this module is about
- Lesson 2: how the browser PICKS which selector wins (specificity).
- Lesson 3: which properties cascade from parent β child (inheritance).
- Lessons 5-7: the box model β content, padding, border, margin.
- Lessons 8-9:
box-sizing: border-boxand why it's a default. - Lesson 10: capstone combining all the above.
Live preview