Divs
In the previous exercise, we learned that the p
element is the most commonly used text element. Now let's take a look at perhaps the most commonly used element in HTML - the div
element.
<div>
<h1>I belong to a paragraph!</h1>
<p>I belong to a heading!</p>
</div>
The div
element is used for grouping HTML elements. Although it is not visible on its own, it is very useful when we want to apply the same style to all elements nested within it. We can also apply different styles to the div
element itself. We don't know what styles are yet, but we will learn about them in the CSS course.
Instructions
Create an opening tag <div>
before the heading h2
with the text Description
, then create a closing tag </div>
after the paragraph p
describing the Domestic Cat. Don't forget to indent the elements that are now children of the div
element. (with a space or a tab).
Create an opening tag <div>
before the heading h2
with the text Physiology
, then create a closing tag </div>
after the paragraph p
starting with It is a crepuscular...
.
Start programming for free
3/8