HTML elements can be nested (elements can contain other elements).
Example:
<em> This is a <strong>very important</strong> paragraph.</em>
And this is the result:
This is a very important paragraph.However, be careful when you include an element in another.
For example, this is not correct:
<em> This is a <strong>very important</em> paragraph.</strong>
When incorrectly nested, Weird behavior and unexpected errors can occur!
We have already seen the h1
element to define a title (headings).
You can have several levels of headings in your document: use h2
for second level, h3
for third level and so on.
Open page2.html
and edit the document to include headings.
On the slide, you will see the expected result.
HTML defines two types of lists: ordered lists (ol), and unordered lists (ul).
In both, a list item is identified by the li element.
Let's see some examples.
<ol>
<li>Code</li>
<li>Test</li>
<li>Be proud!</li>
</ol>
<ul>
<li>HTML</li>
<li>CSS</li>
<li>JS</li>
</ul>
Open page2.html
and use the elements you've just discovered to add lists.
The text is already written for you.
The expected result is shown just after.
If you have time, add a link from this page to page2.html
, and from page2.html
to this page!
F12
on your web browser? It is sometimes helpful... especially when you have a bug!