Headings and Emphasis
Paragraphs are used to separate pieces of text, but sometimes you want text to stand out. HTML offers different tags for creating headings and emphasis.
Headings
To mark headings in a page, use the h
tags. The h
tags are marked with a number from 1 to 6 to specify the heading level. Use an <h1>
tag for the largest heading on the page, and use lower h
tags for sub-headings:
<h1>Highest Heading</h1>
<h2>Sub-heading</h2>
<h3>Level 3 heading</h3>
<p>Regular text</p>
Emphasis
Sometimes you want to emphasize certain text that's not a heading. Use the <em></em>
tags to do this. Need to really emphasize something? Use the <strong></strong>
tags:
<h3>Acme Acid Info</h3> <p>Acme Acid is great for cleaning, etc. <em>Warning: Keep away from furniture.</em> <strong>Danger! May cause instant death.</strong> </p> |
Acme Acid InfoAcme Acid is great for cleaning, etc. Warning: Keep away from furniture. Danger! May cause instant death. |
Note that the <strong>
and <em>
elements are inside the <p>
element. Most elements can be nested inside each other in HTML, but make sure you place the closing tags correctly!
Challenge
Create a paragraph with the <p>
tag. Then put the word hypertext
inside the paragraph and mark it as <strong>
.
Please sign in or sign up to submit answers.
Alternatively, you can try out Learneroo before signing up.
Challenge
How do you think a 4th-level heading is marked? Create a 4th-level heading and put the text level 4
between the tags.
Please sign in or sign up to submit answers.
Alternatively, you can try out Learneroo before signing up.