HTML • Chapter 3 • Foundations to Production
Character Encoding and Language
Each topic contains substantial explanation, ten focused teaching examples, its own HTML code example, code reasoning, expected browser result, and practice.
3.1 UTF-8 Charset
UTF-8 Charset is part of the HTML structure covered in Chapter 3. HTML communicates meaning and document relationships to browsers, search engines, assistive technology, and other tools, so the choice of element or attribute should match the content rather than only its visual appearance.
For UTF-8 Charset, examine the element's permitted content, relevant attributes, semantic meaning, accessibility effect, and how it behaves when CSS or JavaScript is unavailable. In character encoding and language, the markup should remain understandable as a document before presentation is added.
In Chapter 3, a reliable way to learn UTF-8 Charset is to write a small valid fragment, inspect the browser result and document outline, then test one incorrect or missing attribute. This makes the reason for each piece of markup visible instead of treating HTML as a collection of tags to memorize.
Concept in plain language
UTF-8 Charset is part of the HTML structure covered in Chapter 3. HTML communicates meaning and document relationships to browsers, search engines, assistive technology, and other tools, so the choice of element or attribute should match the content rather than only its visual appearance.
10 teaching examples
Example 1: Minimal markup
Create the smallest valid school page example that demonstrates UTF-8 Charset. Identify which part carries meaning and which parts are only supporting structure. This is Chapter 3, topic 1, example 1.
Example 2: Content variation
Change the text or resource used by UTF-8 Charset in the course lesson. Confirm that the markup still describes the new content correctly instead of depending on the old wording. This is Chapter 3, topic 1, example 2.
Example 3: Missing-information test
Remove one important attribute or related element from the news article example using UTF-8 Charset. Explain what meaning, accessibility, navigation, or browser behavior is lost. This is Chapter 3, topic 1, example 3.
Example 4: Accessibility review
Read the contact page example using the semantics of UTF-8 Charset. Check names, labels, landmarks, alternatives, focus behavior, and whether the content still makes sense without styling. This is Chapter 3, topic 1, example 4.
Example 5: Mobile review
Open the product description markup containing UTF-8 Charset on a narrow screen. Ensure embedded content, long text, controls, and translated labels do not force the page wider than the viewport. This is Chapter 3, topic 1, example 5.
Example 6: RTL review
Translate the profile page into Arabic or Persian. Keep document text RTL where appropriate while URLs, code samples, numbers, and intentionally LTR fragments remain readable. This is Chapter 3, topic 1, example 6.
Example 7: Validation exercise
Run the documentation page fragment using UTF-8 Charset through an HTML validator. Fix invalid nesting, duplicate IDs, missing required attributes, or obsolete markup before adding extra features. This is Chapter 3, topic 1, example 7.
Example 8: Progressive-enhancement check
Use UTF-8 Charset in the event page so the core content remains useful before CSS and JavaScript load. Add enhancement only after the document structure is complete. This is Chapter 3, topic 1, example 8.
Example 9: SEO and semantics review
Inspect how UTF-8 Charset contributes to the meaning of the FAQ page. Keep headings, links, metadata, and document regions consistent so crawlers and users receive the same primary content. This is Chapter 3, topic 1, example 9.
Example 10: Production review
Review UTF-8 Charset in the photo story for validity, accessibility, security-related attributes, performance hints, responsive behavior, localization, and maintainability. This is Chapter 3, topic 1, example 10.
HTML code example
<head>
<meta charset="utf-8">
<title>UTF-8 page</title>
</head>Step-by-step code explanation
- Identify the element or attribute responsible for UTF-8 Charset.
- Read the markup from the outer document structure inward and verify that each child is allowed in its parent context.
- Check the semantic meaning and any accessibility relationship such as labels, alternatives, headings, captions, or landmarks.
- Open the fragment in a browser and compare the rendered result with the source instead of assuming visual appearance proves validity.
- Validate the markup and test responsive, RTL, and no-JavaScript behavior where they apply.
Expected browser result: The browser displays or exposes the structure appropriate for UTF-8 Charset while preserving the semantic relationships expressed by the markup.
Practice exercise
Write a fresh HTML fragment for UTF-8 Charset in Chapter 3. Validate it, remove one important attribute or related element to observe the difference, then restore the correct markup. Test the result with keyboard navigation when interactive, on a narrow screen, and in Arabic or Persian when the content can be translated.
3.2 lang Attribute
lang Attribute is part of the HTML structure covered in Chapter 3. HTML communicates meaning and document relationships to browsers, search engines, assistive technology, and other tools, so the choice of element or attribute should match the content rather than only its visual appearance.
For lang Attribute, examine the element's permitted content, relevant attributes, semantic meaning, accessibility effect, and how it behaves when CSS or JavaScript is unavailable. In character encoding and language, the markup should remain understandable as a document before presentation is added.
In Chapter 3, a reliable way to learn lang Attribute is to write a small valid fragment, inspect the browser result and document outline, then test one incorrect or missing attribute. This makes the reason for each piece of markup visible instead of treating HTML as a collection of tags to memorize.
Concept in plain language
lang Attribute is part of the HTML structure covered in Chapter 3. HTML communicates meaning and document relationships to browsers, search engines, assistive technology, and other tools, so the choice of element or attribute should match the content rather than only its visual appearance.
10 teaching examples
Example 1: Minimal markup
Create the smallest valid news article example that demonstrates lang Attribute. Identify which part carries meaning and which parts are only supporting structure. This is Chapter 3, topic 2, example 1.
Example 2: Content variation
Change the text or resource used by lang Attribute in the contact page. Confirm that the markup still describes the new content correctly instead of depending on the old wording. This is Chapter 3, topic 2, example 2.
Example 3: Missing-information test
Remove one important attribute or related element from the product description example using lang Attribute. Explain what meaning, accessibility, navigation, or browser behavior is lost. This is Chapter 3, topic 2, example 3.
Example 4: Accessibility review
Read the profile page example using the semantics of lang Attribute. Check names, labels, landmarks, alternatives, focus behavior, and whether the content still makes sense without styling. This is Chapter 3, topic 2, example 4.
Example 5: Mobile review
Open the documentation page markup containing lang Attribute on a narrow screen. Ensure embedded content, long text, controls, and translated labels do not force the page wider than the viewport. This is Chapter 3, topic 2, example 5.
Example 6: RTL review
Translate the event page into Arabic or Persian. Keep document text RTL where appropriate while URLs, code samples, numbers, and intentionally LTR fragments remain readable. This is Chapter 3, topic 2, example 6.
Example 7: Validation exercise
Run the FAQ page fragment using lang Attribute through an HTML validator. Fix invalid nesting, duplicate IDs, missing required attributes, or obsolete markup before adding extra features. This is Chapter 3, topic 2, example 7.
Example 8: Progressive-enhancement check
Use lang Attribute in the photo story so the core content remains useful before CSS and JavaScript load. Add enhancement only after the document structure is complete. This is Chapter 3, topic 2, example 8.
Example 9: SEO and semantics review
Inspect how lang Attribute contributes to the meaning of the support page. Keep headings, links, metadata, and document regions consistent so crawlers and users receive the same primary content. This is Chapter 3, topic 2, example 9.
Example 10: Production review
Review lang Attribute in the dashboard shell for validity, accessibility, security-related attributes, performance hints, responsive behavior, localization, and maintainability. This is Chapter 3, topic 2, example 10.
HTML code example
<html lang="en-CA">
<body><p lang="fr">Bonjour tout le monde.</p></body>
</html>Step-by-step code explanation
- Identify the element or attribute responsible for lang Attribute.
- Read the markup from the outer document structure inward and verify that each child is allowed in its parent context.
- Check the semantic meaning and any accessibility relationship such as labels, alternatives, headings, captions, or landmarks.
- Open the fragment in a browser and compare the rendered result with the source instead of assuming visual appearance proves validity.
- Validate the markup and test responsive, RTL, and no-JavaScript behavior where they apply.
Expected browser result: The browser displays or exposes the structure appropriate for lang Attribute while preserving the semantic relationships expressed by the markup.
Practice exercise
Write a fresh HTML fragment for lang Attribute in Chapter 3. Validate it, remove one important attribute or related element to observe the difference, then restore the correct markup. Test the result with keyboard navigation when interactive, on a narrow screen, and in Arabic or Persian when the content can be translated.
3.3 dir Attribute
dir Attribute is part of the HTML structure covered in Chapter 3. HTML communicates meaning and document relationships to browsers, search engines, assistive technology, and other tools, so the choice of element or attribute should match the content rather than only its visual appearance.
For dir Attribute, examine the element's permitted content, relevant attributes, semantic meaning, accessibility effect, and how it behaves when CSS or JavaScript is unavailable. In character encoding and language, the markup should remain understandable as a document before presentation is added.
In Chapter 3, a reliable way to learn dir Attribute is to write a small valid fragment, inspect the browser result and document outline, then test one incorrect or missing attribute. This makes the reason for each piece of markup visible instead of treating HTML as a collection of tags to memorize.
Concept in plain language
dir Attribute is part of the HTML structure covered in Chapter 3. HTML communicates meaning and document relationships to browsers, search engines, assistive technology, and other tools, so the choice of element or attribute should match the content rather than only its visual appearance.
10 teaching examples
Example 1: Minimal markup
Create the smallest valid product description example that demonstrates dir Attribute. Identify which part carries meaning and which parts are only supporting structure. This is Chapter 3, topic 3, example 1.
Example 2: Content variation
Change the text or resource used by dir Attribute in the profile page. Confirm that the markup still describes the new content correctly instead of depending on the old wording. This is Chapter 3, topic 3, example 2.
Example 3: Missing-information test
Remove one important attribute or related element from the documentation page example using dir Attribute. Explain what meaning, accessibility, navigation, or browser behavior is lost. This is Chapter 3, topic 3, example 3.
Example 4: Accessibility review
Read the event page example using the semantics of dir Attribute. Check names, labels, landmarks, alternatives, focus behavior, and whether the content still makes sense without styling. This is Chapter 3, topic 3, example 4.
Example 5: Mobile review
Open the FAQ page markup containing dir Attribute on a narrow screen. Ensure embedded content, long text, controls, and translated labels do not force the page wider than the viewport. This is Chapter 3, topic 3, example 5.
Example 6: RTL review
Translate the photo story into Arabic or Persian. Keep document text RTL where appropriate while URLs, code samples, numbers, and intentionally LTR fragments remain readable. This is Chapter 3, topic 3, example 6.
Example 7: Validation exercise
Run the support page fragment using dir Attribute through an HTML validator. Fix invalid nesting, duplicate IDs, missing required attributes, or obsolete markup before adding extra features. This is Chapter 3, topic 3, example 7.
Example 8: Progressive-enhancement check
Use dir Attribute in the dashboard shell so the core content remains useful before CSS and JavaScript load. Add enhancement only after the document structure is complete. This is Chapter 3, topic 3, example 8.
Example 9: SEO and semantics review
Inspect how dir Attribute contributes to the meaning of the language page. Keep headings, links, metadata, and document regions consistent so crawlers and users receive the same primary content. This is Chapter 3, topic 3, example 9.
Example 10: Production review
Review dir Attribute in the booking page for validity, accessibility, security-related attributes, performance hints, responsive behavior, localization, and maintainability. This is Chapter 3, topic 3, example 10.
HTML code example
<section dir="rtl" lang="fa">
<h2>نمونه متن فارسی</h2>
<p>کد: <bdi dir="ltr">HTML-101</bdi></p>
</section>Step-by-step code explanation
- Identify the element or attribute responsible for dir Attribute.
- Read the markup from the outer document structure inward and verify that each child is allowed in its parent context.
- Check the semantic meaning and any accessibility relationship such as labels, alternatives, headings, captions, or landmarks.
- Open the fragment in a browser and compare the rendered result with the source instead of assuming visual appearance proves validity.
- Validate the markup and test responsive, RTL, and no-JavaScript behavior where they apply.
Expected browser result: The browser displays or exposes the structure appropriate for dir Attribute while preserving the semantic relationships expressed by the markup.
Practice exercise
Write a fresh HTML fragment for dir Attribute in Chapter 3. Validate it, remove one important attribute or related element to observe the difference, then restore the correct markup. Test the result with keyboard navigation when interactive, on a narrow screen, and in Arabic or Persian when the content can be translated.
3.4 bdi Element
bdi Element is part of the HTML structure covered in Chapter 3. HTML communicates meaning and document relationships to browsers, search engines, assistive technology, and other tools, so the choice of element or attribute should match the content rather than only its visual appearance.
For bdi Element, examine the element's permitted content, relevant attributes, semantic meaning, accessibility effect, and how it behaves when CSS or JavaScript is unavailable. In character encoding and language, the markup should remain understandable as a document before presentation is added.
In Chapter 3, a reliable way to learn bdi Element is to write a small valid fragment, inspect the browser result and document outline, then test one incorrect or missing attribute. This makes the reason for each piece of markup visible instead of treating HTML as a collection of tags to memorize.
Concept in plain language
bdi Element is part of the HTML structure covered in Chapter 3. HTML communicates meaning and document relationships to browsers, search engines, assistive technology, and other tools, so the choice of element or attribute should match the content rather than only its visual appearance.
10 teaching examples
Example 1: Minimal markup
Create the smallest valid documentation page example that demonstrates bdi Element. Identify which part carries meaning and which parts are only supporting structure. This is Chapter 3, topic 4, example 1.
Example 2: Content variation
Change the text or resource used by bdi Element in the event page. Confirm that the markup still describes the new content correctly instead of depending on the old wording. This is Chapter 3, topic 4, example 2.
Example 3: Missing-information test
Remove one important attribute or related element from the FAQ page example using bdi Element. Explain what meaning, accessibility, navigation, or browser behavior is lost. This is Chapter 3, topic 4, example 3.
Example 4: Accessibility review
Read the photo story example using the semantics of bdi Element. Check names, labels, landmarks, alternatives, focus behavior, and whether the content still makes sense without styling. This is Chapter 3, topic 4, example 4.
Example 5: Mobile review
Open the support page markup containing bdi Element on a narrow screen. Ensure embedded content, long text, controls, and translated labels do not force the page wider than the viewport. This is Chapter 3, topic 4, example 5.
Example 6: RTL review
Translate the dashboard shell into Arabic or Persian. Keep document text RTL where appropriate while URLs, code samples, numbers, and intentionally LTR fragments remain readable. This is Chapter 3, topic 4, example 6.
Example 7: Validation exercise
Run the language page fragment using bdi Element through an HTML validator. Fix invalid nesting, duplicate IDs, missing required attributes, or obsolete markup before adding extra features. This is Chapter 3, topic 4, example 7.
Example 8: Progressive-enhancement check
Use bdi Element in the booking page so the core content remains useful before CSS and JavaScript load. Add enhancement only after the document structure is complete. This is Chapter 3, topic 4, example 8.
Example 9: SEO and semantics review
Inspect how bdi Element contributes to the meaning of the media page. Keep headings, links, metadata, and document regions consistent so crawlers and users receive the same primary content. This is Chapter 3, topic 4, example 9.
Example 10: Production review
Review bdi Element in the school page for validity, accessibility, security-related attributes, performance hints, responsive behavior, localization, and maintainability. This is Chapter 3, topic 4, example 10.
HTML code example
<section dir="rtl" lang="fa">
<h2>نمونه متن فارسی</h2>
<p>کد: <bdi dir="ltr">HTML-101</bdi></p>
</section>Step-by-step code explanation
- Identify the element or attribute responsible for bdi Element.
- Read the markup from the outer document structure inward and verify that each child is allowed in its parent context.
- Check the semantic meaning and any accessibility relationship such as labels, alternatives, headings, captions, or landmarks.
- Open the fragment in a browser and compare the rendered result with the source instead of assuming visual appearance proves validity.
- Validate the markup and test responsive, RTL, and no-JavaScript behavior where they apply.
Expected browser result: The browser displays or exposes the structure appropriate for bdi Element while preserving the semantic relationships expressed by the markup.
Practice exercise
Write a fresh HTML fragment for bdi Element in Chapter 3. Validate it, remove one important attribute or related element to observe the difference, then restore the correct markup. Test the result with keyboard navigation when interactive, on a narrow screen, and in Arabic or Persian when the content can be translated.
3.5 bdo Element
bdo Element is part of the HTML structure covered in Chapter 3. HTML communicates meaning and document relationships to browsers, search engines, assistive technology, and other tools, so the choice of element or attribute should match the content rather than only its visual appearance.
For bdo Element, examine the element's permitted content, relevant attributes, semantic meaning, accessibility effect, and how it behaves when CSS or JavaScript is unavailable. In character encoding and language, the markup should remain understandable as a document before presentation is added.
In Chapter 3, a reliable way to learn bdo Element is to write a small valid fragment, inspect the browser result and document outline, then test one incorrect or missing attribute. This makes the reason for each piece of markup visible instead of treating HTML as a collection of tags to memorize.
Concept in plain language
bdo Element is part of the HTML structure covered in Chapter 3. HTML communicates meaning and document relationships to browsers, search engines, assistive technology, and other tools, so the choice of element or attribute should match the content rather than only its visual appearance.
10 teaching examples
Example 1: Minimal markup
Create the smallest valid FAQ page example that demonstrates bdo Element. Identify which part carries meaning and which parts are only supporting structure. This is Chapter 3, topic 5, example 1.
Example 2: Content variation
Change the text or resource used by bdo Element in the photo story. Confirm that the markup still describes the new content correctly instead of depending on the old wording. This is Chapter 3, topic 5, example 2.
Example 3: Missing-information test
Remove one important attribute or related element from the support page example using bdo Element. Explain what meaning, accessibility, navigation, or browser behavior is lost. This is Chapter 3, topic 5, example 3.
Example 4: Accessibility review
Read the dashboard shell example using the semantics of bdo Element. Check names, labels, landmarks, alternatives, focus behavior, and whether the content still makes sense without styling. This is Chapter 3, topic 5, example 4.
Example 5: Mobile review
Open the language page markup containing bdo Element on a narrow screen. Ensure embedded content, long text, controls, and translated labels do not force the page wider than the viewport. This is Chapter 3, topic 5, example 5.
Example 6: RTL review
Translate the booking page into Arabic or Persian. Keep document text RTL where appropriate while URLs, code samples, numbers, and intentionally LTR fragments remain readable. This is Chapter 3, topic 5, example 6.
Example 7: Validation exercise
Run the media page fragment using bdo Element through an HTML validator. Fix invalid nesting, duplicate IDs, missing required attributes, or obsolete markup before adding extra features. This is Chapter 3, topic 5, example 7.
Example 8: Progressive-enhancement check
Use bdo Element in the school page so the core content remains useful before CSS and JavaScript load. Add enhancement only after the document structure is complete. This is Chapter 3, topic 5, example 8.
Example 9: SEO and semantics review
Inspect how bdo Element contributes to the meaning of the course lesson. Keep headings, links, metadata, and document regions consistent so crawlers and users receive the same primary content. This is Chapter 3, topic 5, example 9.
Example 10: Production review
Review bdo Element in the news article for validity, accessibility, security-related attributes, performance hints, responsive behavior, localization, and maintainability. This is Chapter 3, topic 5, example 10.
HTML code example
<section dir="rtl" lang="fa">
<h2>نمونه متن فارسی</h2>
<p>کد: <bdi dir="ltr">HTML-101</bdi></p>
</section>Step-by-step code explanation
- Identify the element or attribute responsible for bdo Element.
- Read the markup from the outer document structure inward and verify that each child is allowed in its parent context.
- Check the semantic meaning and any accessibility relationship such as labels, alternatives, headings, captions, or landmarks.
- Open the fragment in a browser and compare the rendered result with the source instead of assuming visual appearance proves validity.
- Validate the markup and test responsive, RTL, and no-JavaScript behavior where they apply.
Expected browser result: The browser displays or exposes the structure appropriate for bdo Element while preserving the semantic relationships expressed by the markup.
Practice exercise
Write a fresh HTML fragment for bdo Element in Chapter 3. Validate it, remove one important attribute or related element to observe the difference, then restore the correct markup. Test the result with keyboard navigation when interactive, on a narrow screen, and in Arabic or Persian when the content can be translated.
Chapter 3 review — 10 questions and answers
1. What should you check first when using UTF-8 Charset?
Answer: Check that the markup for UTF-8 Charset matches the meaning of the content, is valid in its context, and does not depend on visual styling to communicate essential information.
2. How do you review UTF-8 Charset before publishing?
Answer: Validate the HTML, inspect accessibility and keyboard behavior where relevant, test narrow screens and translated text, and confirm that UTF-8 Charset adds real document meaning or browser behavior.
3. What should you check first when using lang Attribute?
Answer: Check that the markup for lang Attribute matches the meaning of the content, is valid in its context, and does not depend on visual styling to communicate essential information.
4. How do you review lang Attribute before publishing?
Answer: Validate the HTML, inspect accessibility and keyboard behavior where relevant, test narrow screens and translated text, and confirm that lang Attribute adds real document meaning or browser behavior.
5. What should you check first when using dir Attribute?
Answer: Check that the markup for dir Attribute matches the meaning of the content, is valid in its context, and does not depend on visual styling to communicate essential information.
6. How do you review dir Attribute before publishing?
Answer: Validate the HTML, inspect accessibility and keyboard behavior where relevant, test narrow screens and translated text, and confirm that dir Attribute adds real document meaning or browser behavior.
7. What should you check first when using bdi Element?
Answer: Check that the markup for bdi Element matches the meaning of the content, is valid in its context, and does not depend on visual styling to communicate essential information.
8. How do you review bdi Element before publishing?
Answer: Validate the HTML, inspect accessibility and keyboard behavior where relevant, test narrow screens and translated text, and confirm that bdi Element adds real document meaning or browser behavior.
9. What should you check first when using bdo Element?
Answer: Check that the markup for bdo Element matches the meaning of the content, is valid in its context, and does not depend on visual styling to communicate essential information.
10. How do you review bdo Element before publishing?
Answer: Validate the HTML, inspect accessibility and keyboard behavior where relevant, test narrow screens and translated text, and confirm that bdo Element adds real document meaning or browser behavior.