Lesson Outcomes
After completing this lesson, learners will be able to:
- Explain the concept of HTML data types.
- Identify different types of content used in HTML.
- Describe how text, characters, and numbers are represented in HTML.
- Understand the purpose of character sets and encoding.
- Recognise different types of content used in web pages.
Overview
In HTML, data types refer to the different kinds of content that can be used and displayed on a web page.
Although HTML does not use strict data types like programming languages, it supports various types of content such as:
- Text
- Images
- Links
- Media
- Forms
Understanding these data types helps developers structure and display information correctly on web pages.
1. What are HTML Data Types?
HTML data types refer to the different forms of content that can be included in an HTML document.
These include:
- Text content
- Multimedia content
- Links
- Structured data (tables, lists)
HTML uses elements and attributes to define how these data types are displayed.
2. Types of HTML Data
HTML supports different types of data used in web pages.
2.1 Text Content
Text is the most common type of data in HTML.
Examples include:
- Paragraphs (
<p>) - Headings (
<h1>to<h6>) - Labels and descriptions
Text content is used to display information to users.
2.2 Character Data
Character data refers to letters, symbols, and special characters.
Examples include:
- Letters (A, B, C)
- Numbers (1, 2, 3)
- Symbols (
<,>,&)
Special characters are written using HTML entities.
Example:
<represents<>represents>
2.3 Numeric Data
Numeric data includes numbers used in web pages.
Examples include:
- Prices
- Quantities
- Measurements
- Dates and time
Numbers can be displayed as text or used in forms and calculations.
2.4 Links (Hyperlinks)
Links connect web pages and resources.
They are created using the <a> tag.
Example:
<a href="https://example.com">Visit Website</a>
Links allow navigation between pages.
2.5 Images and Multimedia
HTML supports media elements such as:
- Images (
<img>) - Audio (
<audio>) - Video (
<video>)
These elements improve user experience.
2.6 Structured Data
Structured data helps organise information.
Examples include:
- Lists (
<ul>,<ol>) - Tables (
<table>)
This makes content easier to read and understand.
3. Character Sets and Encoding
Character encoding defines how text is stored and displayed.
The most common encoding is:
- UTF-8
It supports:
- Multiple languages
- Symbols
- Special characters
Example declaration:
<meta charset="UTF-8">
This ensures that text is displayed correctly across different browsers and devices.
4. Content Types in HTML
HTML supports different content types that help structure web pages.
These include:
- Text content
- Media content
- Interactive content (forms, inputs)
- Metadata
Each type serves a different purpose in building web pages.
5. Importance of HTML Data Types
Understanding HTML data types is important because it helps developers:
- Structure content correctly
- Display information clearly
- Avoid errors with characters and symbols
- Improve user experience
Correct use of data types ensures that web pages are readable and functional.
Key Notes
- HTML data types refer to different types of content used in web pages.
- Common data types include text, characters, numbers, links, and media.
- Special characters are written using HTML entities.
- UTF-8 is the standard character encoding.
- HTML elements are used to define how data is displayed.
- Structured data helps organise information clearly.
- Understanding data types improves web page design and functionality.