HTML XHTML
You may see older materials labeled XHTML. It was HTML written with XML rules. Today, HTML5 is the mainstream teaching and browser target.
Direct answer
XHTML required stricter syntax: lowercase tag names, quoted attributes, and explicit closing of empty elements like <br />. HTML5 parsers are more forgiving but you should still write clean, consistent markup. For new projects, use HTML5 doctype and habits from this course.
📊 HTML5 vs classic XHTML habits
| Topic | HTML5 (typical) | XHTML-style strictness |
|---|---|---|
| Doctype | <!DOCTYPE html> | Older XHTML doctypes |
| Empty tags | <br> fine | Often <br /> |
| Attribute quotes | Strongly recommended | Required in XHTML |
| Case | Usually lowercase by convention | Lowercase required in XHTML |
Same idea, stricter empty tag style
html<!-- HTML5-friendly -->
<p>Line one<br>Line two</p>
<!-- XHTML-looking empty tag -->
<p>Line one<br />Line two</p>
Try it
- Rewrite a tiny page ensuring quoted attributes and closed elements
- Keep
<!DOCTYPE html> - Notice browsers still render careful HTML5 well
- When reading old XHTML tutorials, translate ideas into HTML5 practice
Easy mistakes
- Forcing full XHTML MIME/XML modes without understanding them
- Thinking HTML5 allows sloppy inaccessible markup
- Mixing eras randomly in one project without a style guide
Summary
- XHTML = stricter XML-flavored HTML history
- HTML5 is the modern default
- Clean markup still matters
- Use this course’s HTML5 patterns going forward
🧠 Test Your Knowledge
Test Your Knowledge
Challenge yourself with this interactive quiz and see how well you understand the topic
📝 Instructions
- Read each question carefully
- Select the best answer for each question
- You can retake the quiz as many times as you want
- Your progress will be shown at the top