TGViewer
Web Development Web Development @web_dev_bds ยท 4.44K subscribers
Post #841 658
๐ŸŒ Semantic HTML (The Meaning of Code) ๐Ÿ—

Many beginners build websites using only <div> and <span> tags. While this perfectly "works," it creates a website that is hard for search engines to read and impossible for visually impaired users to navigate.

๐Ÿ”น 1. What is Semantic HTML?

A semantic element clearly describes its meaning to both the browser and the developer. Instead of just saying "this is a box," it says "this is a navigation menu" or "this is a footer."

โ€ข Non-semantic: <div>, <span> (Tells us nothing about the content).
โ€ข Semantic: <header>, <nav>, <main>, <article>, <section>, <footer>.

๐Ÿ”น 2. Why it Matters #1: SEO (Search Engines)

Googleโ€™s "spiders" crawl your site to understand what itโ€™s about. If everything is in a <div>, Google struggles to find the most important info. If you use an <article> tag, Google knows exactly where your main content is, which can improve your search rankings.

๐Ÿ”น 3. Why it Matters #2: Accessibility (a11y)

Millions of people use Screen Readers to browse the web. A screen reader can "jump" directly to a <nav> or a <main> tag. If you only use <div>, the user has to listen to every single line of code to find what they need.

๐Ÿ”น 4. Common Semantic Tags to Use Now

โ€ข <header>: For the top intro/logo area.
โ€ข <nav>: Specifically for navigation links.
โ€ข <main>: The unique, primary content of the page (only use one per page!).
โ€ข <section>: For grouping related content (like "Services" or "Contact").
โ€ข <article>: For independent content that could stand alone (like a blog post).
โ€ข <footer>: For the bottom area (copyright, social links).

๐Ÿ”น 5. Semantic vs. Non-Semantic (The Comparison)

Bad Code (The "Div Soup"):
<div class="top-part">
<div class="menu">Links here...</div>
</div>

Good Code (Semantic):
<header>
<nav>Links here...</nav>
</header>

๐Ÿ”น 6. Buttons vs. Anchors (<a>)

This is the most common mistake!
โ€ข Use <a>: If you are taking the user to a new URL or a different page.
โ€ข Use <button>: If you are performing an action (like submitting a form, opening a menu, or deleting an item).

๐Ÿ‘‰ Writing Semantic HTML doesn't change how the site looks, but it changes how the world experiences it!

๐ŸŽฏ What you should do

โœ”๏ธ Stop using <div> for every layout container
โœ”๏ธ Use the correct tags to help Google rank your site
โœ”๏ธ Make your website usable for people with disabilities
โœ”๏ธ Choose between <a> and <button> correctly
  • โค 3
More from @web_dev_bds
  1. Oct 12, 2026Post #1054
  2. Oct 11, 2026CSS Tip Stop centring tooltips with ๐š๐š›๐šŠ๐š—๐šœ๐š•๐šŠ๐š๐šŽ: -๐Ÿป๐Ÿถ%. near the edge of the screeโ€ฆ
  3. Oct 9, 2026JavaScript CheatSheet
  4. Oct 8, 2026๐Ÿ“•Pro tip if you're using Postgres: Set `application_name` in your app's DB connector/ORM/โ€ฆ
  5. Oct 7, 2026๐Ÿš€ Beginner โ†’ Developer: What to Learn in 6 Months Want to become job-ready but don't knowโ€ฆ
  6. Oct 6, 2026React vs Angular
Threads Profile ViewerView any public Threads profile without an account.Open ThreadLook โ†’Writing with AI? Make it sound human.Metric37 rewrites AI drafts so they read naturally. Free AI detector, 1,500 words free.Try Metric37 โ†’