Short answer: a handful of HTML tags cover almost everything you need to format text on the web, headings, paragraphs, bold and italic, links, images, and lists. Knowing these lets you write cleanly in blogs, forums, emails and anywhere HTML is accepted. Here are the essential codes with examples.
Text structure
<h1>Main heading</h1> <h2>Section heading</h2> <p>A paragraph of text.</p> <br> (a line break)
Use one <h1> per page, then <h2> and <h3> for sections. Wrap paragraphs in <p>.
Emphasis
<strong>bold text</strong> <em>italic text</em>
Use <strong> for bold and <em> for italic, they carry meaning (importance/emphasis), which is better than the purely visual <b> and <i>.
Links
<a href="https://example.com">Link text</a>
Add target="_blank" rel="noopener" to open in a new tab safely: <a href="..." target="_blank" rel="noopener">...</a>.
Images
<img src="image.jpg" alt="description">
Always include alt text describing the image, it helps accessibility and SEO, and shows if the image fails to load.
Lists
<ul> <li>Bulleted item</li> <li>Another item</li> </ul> <ol> <li>Numbered item</li> <li>Second item</li> </ol>
The 10 essentials at a glance
| Tag | Purpose |
|---|---|
| <h1>-<h3> | Headings |
| <p> | Paragraph |
| <strong> / <em> | Bold / italic |
| <a> | Link |
| <img> | Image |
| <ul>/<ol>/<li> | Lists |
| <br> | Line break |
The non-obvious tip: close your tags and use semantic ones
Two habits keep your HTML clean: close every tag you open (an unclosed <a> can turn your whole page into a link), and prefer semantic tags (<strong>, <em>, real headings) over purely visual ones. Semantic HTML is better for accessibility and SEO, and it makes your content render correctly everywhere HTML is accepted.
Frequently asked questions
What are the most essential HTML tags?
Headings (h1-h3), paragraphs (p), bold and italic (strong, em), links (a), images (img), and lists (ul, ol, li). These cover most web text formatting.
How do I make a link in HTML?
Use text. Add target="_blank" rel="noopener" to open it safely in a new tab.
Should I use strong or b for bold?
Use , which conveys importance and is better for accessibility and SEO than the purely visual . Same for over for italics.
What is the most common HTML mistake?
Forgetting to close a tag, an unclosed link tag, for example, can turn the rest of the page into a link. Always close what you open.
Comments
Post a Comment
If you have anything in mind, please let me know!