Lesson 1 · Unit 01
Elements
Tags, attributes and the tree they build
What you practise
- Tags, attributes and nesting, the document skeleton, block against inline, void elements, the tree a snippet produces
Try a question from this lesson
Pick one
HTML nests like folders inside folders. How many children does the <ul> have here?
<ul>
<li>Tea</li>
<li>Milk <b>cold</b></li>
</ul>Hint
A child sits exactly one level down. Anything deeper belongs to someone else.
Correct answer
2
Why
The two <li> elements are the children. The <b> is one level deeper: it is a child of the second <li>, so a grandchild of the list. Every page is a tree like this, and CSS and scripts find things by walking it.
The ideas
Concept cards are short on purpose. In the app they appear between questions, after you have met the idea.
Concept
Elements, tags, attributes
An element is an opening tag, some content and a closing tag. Here the content is the text "Today's menu".
Attributes sit in the opening tag as name="value". They configure the element: href says where this link goes.
Elements inside elements form a tree of parents, children and siblings.
<a href="/menu">Today's menu</a>Concept
The skeleton
Every page has the same frame. <!doctype html> tells the browser to use modern rules. <html> holds exactly two children.
<head> is information about the page: its character set, its title, later its styles. <body> is everything the user sees.
<!doctype html>
<html lang="en">
<head>
<meta charset="utf-8">
<title>Menu</title>
</head>
<body>
<h1>Menu</h1>
</body>
</html>10 more exercises in the app
- 3× type the answer
- 4× multiple choice
- 1× order the lines
- 1× fill the blanks
- 1× match the pairs
Bitpath is an iOS app in development. Join the waitlist and you get one email when it is ready to try.