HTML Structure — The Role of head and body
HTML Structure — The Role of head and body
🎯 After reading this lesson
After reading through this lesson, you will be able to do the following 3 things with confidence.
- ▸✅ The difference between block and inline
- ▸✅ Properly connecting form, input, and label
- ▸✅ The 4 principles of writing img alt text
Keep the learning objectives as a checklist and close the lesson once you can answer all of them.
The *Anatomy* of an HTML Page
Key Takeaway
Every HTML page is divided into two parts: + . head is meta information that is not visible, while body is the actual visible content.
head — The Back Side of a Page
What goes here:
- ▸Meta information: encoding, viewport, description, OG (social sharing)
- ▸External file links: CSS, JS, fonts, icons
- ▸Search Engine Optimization (SEO): title, description, canonical, etc.
Not directly visible to users, but search engines, social networks, and accessibility tools read this information.
body — The Front Side of a Page
All the content the user actually sees goes here. Structuring meaning with semantic tags (header, main, article, section, aside, footer) is the standard.
5 Essential Elements Often Missed
1. <!DOCTYPE html> — HTML5 declaration. Without it, the browser runs in quirks mode
2. <html lang="ko"> — Declares language. Affects screen readers and translation tools
3. <meta charset="UTF-8"> — 100% prevents garbled characters
4. <meta viewport> — Required for mobile responsiveness
5. <title> — Top SEO priority + browser tab
OG Tags — SNS Share Preview
When sharing links, the preview shown on KakaoTalk and Facebook is determined by OG (Open Graph) tags:
Important for marketing. Without a preview, click-through rates drop ↓.
Summary
head = invisible meta, body = actual content. Good HTML means writing both without omission, semantically.
The Relationship Between Accessibility (a11y), Semantic HTML, and SEO
What Semantic Tags Actually Change
1. Screen Readers — People Who Browse the Web by Ear, Without Sight
NVDA and VoiceOver automatically announce "Link: About". A div click is not read aloud.
2. Keyboard Users — People Who Cannot Use a Mouse
- ▸
<a>and<button>natively support Tab to focus + Enter to activate - ▸
<div onclick>has no Tab focus. Requirestabindex="0"+role="button"+ manually handling keyboard events
3. SEO — Google's Bot Understanding Meaning
Google can automatically identify where the main content is. SEO score improves.
4 Core ARIA Attributes
role — Assigning Meaning
Semantic tags (<button>) take priority whenever possible. ARIA is only for when there is no alternative.
aria-label — An Invisible Label
Communicates the meaning of buttons without visible text. Required for icon buttons and search boxes.
aria-hidden — Hiding from Screen Readers
When text information is duplicated, the icon itself is hidden.
aria-describedby — Linking Additional Description
Also reads the hint when the element receives focus.
alt Text — 4 Principles
Rules:
1. Convey the meaning of the image in text
2. Use alt="" for decorative images (do not omit)
3. Avoid words like "image" or "photo" (screen readers already announce "image")
4. Keep it short and clear
tabindex — Focus Order
Positive tabindex is an anti-pattern. Follow DOM order.
Quick Audit Tools
- ▸Lighthouse (Chrome DevTools) — Accessibility score
- ▸axe DevTools extension — Automated diagnostics
- ▸Use a screen reader directly — Mac VoiceOver (Cmd+F5), Windows NVDA
🤖 Try Asking AI Like This
- ▸"Convert this div-based button to a semantic button tag and add keyboard accessibility"
- ▸"Add aria-label to all of these icon buttons"
- ▸"Rewrite the alt text on this page to be meaning-focused"