INTRODUCTION TO HTML
LESSON 2
OBJECTIVES
- Understand what HTML is
- Identify the different text editors
- Understand document declaration and metadata
- Use Notepad to create HTML codes
- View HTML code in a browser
WHAT IS HTML?
- HTML: An acronym for HyperText Markup Language.
- Often referred to as a programming language, but it lacks logic and functions as a markup language.
- Definition of Markup Language: A set of instructions given to text that dictates how it should be structured, laid out, or formatted.
- Functions of HTML:
- Describes the structure of a web page.
- Serves as a foundational building block for web pages.
HTML TEXT EDITORS
- Common Editors Used for HTML:
- Notepad
- Notepad++
- Sublime Text
- NetBeans
- Dreamweaver
- Visual Studio Code
STARTING HTML IN NOTEPAD
- Open Notepad:
- Click on the Start button.
- Select All Programs.
- Choose Notepad.
- Alternative Method:
- Press Windows + R to open the Run dialog box.
- Type “notepad” and hit Enter.
NOTEPAD WINDOW
- Components of the Notepad Window:
- Title Bar: Indicates the document title (e.g., "Untitled").
- Menu Bar: Provides options like File, Edit, View, etc.
- Control Toolbox: Contains controls for text formatting and manipulation.
- Text Area: The main area for writing code.
- Status Bar: Displays the current line and column number, character count, encoding (e.g., UTF-8), etc.
WHAT IS DOCTYPE?
- Definition:
<!DOCTYPE> is not considered an HTML tag, rather a document declaration. - Purpose: Ensures that browsers render a web page correctly according to the document type.
- Example for HTML5:
- Definition: Metadata refers to information about data.
- Function: The
<meta> tag provides metadata regarding the HTML document. - Placement: Found in the head section of the HTML document and is not visible on the rendered page.
- Example for HTML5:
CREATING A SIMPLE PAGE (STRUCTURE OF A TAG)
- Basic HTML Structure Example:
<!DOCTYPE html>
<html>
<head>
<meta charset="UTF-8">
<title>My Page</title>
</head>
<body>
<h1>Hello World</h1>
<p>This is a simple paragraph.</p>
</body>
</html>
- Components of the Example:
- Start tag: Begins the HTML element.
- End tag: Closes the HTML element.
- Content: Sections visible on the page.
- Information on HTML doc/not visible: Metadata and document declarations are not rendered on the page.
SIMPLE PAGE BREAKDOWN
- Tags Used in the Example:
<!DOCTYPE>: - Meaning: Defines the HTML version in use (HTML5 in this case).
- Additional Info: Refer to the doctypes topic for more detail.
<html>: - Meaning: Opens a HTML document. No tags should follow the closing
</html> tag. - Additional Info: The
lang attribute can specify the primary language using ISO codes (e.g., en for English). <head>: - Meaning: Opens the head section containing document metadata. Does not appear in the main browser window.
- Additional Function: Can include imports from external stylesheets and scripts. Closing tag:
</head>. <meta>: - Meaning: Provides browser with metadata (e.g., character encoding).
- Additional Info: Use
UTF-8, as modern HTML should use this encoding. The <meta> tag does not require a closing tag. <title>: - Meaning: Defines the title of the page. Text inside is shown in the browser tab or title bar.
- Closing tag:
</title>. <body>: - Meaning: Encloses all visible content of the document. No content should be included after the closing tag
</body>. <h1>: - Meaning: Indicates a level 1 heading for the page.
<p>: - Meaning: Represents a paragraph of text.