Bitpath

Lesson 1 · Unit 02

Two trees

HTML becomes the DOM, CSS becomes the CSSOM, and only some nodes get a box

13 exercisesabout 3 min

What you practise

  • HTML parsed into a tree, CSS into another, the render tree that joins them, what display: none removes

Try a question from this lesson

Pick one

Neither paragraph is closed. What does the browser build from this?

HTML
<p>One
<p>Two

The ideas

Concept cards are short on purpose. In the app they appear between questions, after you have met the idea.

Concept

The DOM

The browser does not keep your HTML as text. It parses it into a tree of nodes: the DOM.

Every element is a node, and so is every run of text. Scripts and styles work on this tree, never on the file.

<ul>
  <li>Tea</li>
  <li>Milk</li>
</ul>

ul
  li
    "Tea"
  li
    "Milk"

Concept

The CSSOM

CSS gets a tree of its own: the CSSOM, every rule from every stylesheet.

For each node the browser finds all the rules that match and lets the strongest win. When two are equally strong, the later one wins. So no style is final until all the CSS is in.

10 more exercises in the app

  • 4× type the answer
  • 3× multiple choice
  • 1× true or false
  • 1× order the lines
  • 1× fill the blanks

Bitpath is an iOS app in development. Join the waitlist and you get one email when it is ready to try.

One email when Bitpath is ready to try. Nothing else. Privacy