Text Basics
Headings & Text ⏱ 5 min read 📖 Beginner HTML provides six heading levels ( through ) and several text elements for paragraphs, emphasis, and inline formatting. Using them correctly gives your content structure and meaning. The words on a web page aren't just text — they have hierarchy. Headings tell readers (and search engines) what a page is about and how its sections relate to each other. Inline elements like and add emphasis without breaking the flow of a paragraph. Headings There are six heading levels, from (most important) to (least important): Page Title
Main Section
Sub-section
Smaller heading
Even smaller
Smallest heading
💡 Every page should have exactly one — it's the main title. Think of headings like a document outline: for top-level sections, for sub-sections inside those. Don't skip levels (e.g. don't jump from to ). Paragraphs The
tag wraps a block of text into a paragraph. Browsers add spacing above and below each paragraph automatically:
This is the first paragraph. It can contain as much text as you need.
This is the second paragraph. Each one is treated as a separate block.
Bold and Italic Use for important text (rendered bold) and for emphasis (rendered italic): Please save your work before closing the tab.
The answer is always in the last place you look.
You may also see and used for bold and italic. The difference is semantic: conveys importance, while is just visual styling with no added meaning. Prefer and for meaningful content.
Line Breaks HTML ignores extra whitespace in your source code — multiple spaces or line breaks collapse into one. To force a line break inside a paragraph, use the self-closing
tag: 123 Main Street
Springfield, IL 62701
Inline Code Use to display inline code or technical terms in a monospace font: Use the margin property to add space outside an element.
Blockquotes Use for longer quoted passages: The web does not just connect machines, it connects people.
Horizontal Rule The
element creates a thematic break — a horizontal divider between sections: End of one section.
Start of the next section.
Putting It Together Here is a complete example combining everything from this lesson. The output renders automatically below — click Try It Yourself to edit the code live. My Favourite Recipe
This is my all-time favourite pasta dish. It's incredibly simple to make.
Ingredients
You'll need spaghetti, garlic, olive oil, and parmesan.
Instructions
Cook the pasta. Meanwhile, fry the garlic in oil. Combine and serve.
Output
Write It Yourself Now try writing your own HTML from scratch. Use what you've learned — add headings, paragraphs, bold and italic text, and anything else you want. Hit Run to see your result.
Have anything to say about this lesson?
Your feedback helps improve these tutorials. If something was confusing or missing, let us know.