Introduction to HTML

This lecture notes is based on Prof Doreen De Leon's lectures.

Source

A typical html file look like:
<?xml version="1.0" encoding="UTF-8"?>
<!DOCTYPE html PUBLIC "-//w3c//DTD XHTML 1.0 Strict//EN" "http://www.w3.org/TR/xhtml1/DTD/xhtml1-strict.dtd">
<html xmlns="http://www.w3.org/1999/xhtml" xml:lang="en" lang="en">
<head>
<title>The title is Hello World!</title>
</head>
<body>
<h2>This is a test</h2>
<b>Hello world</b>
</body>
</html>

When view by a browser, it looks like

This is a test

Hello world
Web pages are written in HTML (HyperText Markup Language)
The best way to learn HTML is to view other people's source code.
To view source code, you can :

Editor

An editor is a program to your source code. Example a notepad is an editor. There are several editors in the lab. Example, WinEdit and JEdit. You should choose an editor with syntax highlight. Here are some editors that I use to edit my files

How to write your HTML files on your PC

Structure of an HTML Document

Example

This is the basic format for your html file
<?xml version="1.0" encoding="UTF-8"?>
<!DOCTYPE html PUBLIC "-//w3c//DTD XHTML 1.0 Strict//EN" "http://www.w3.org/TR/xhtml1/DTD/xhtml1-strict.dtd">
<html xmlns="http://www.w3.org/1999/xhtml" xml:lang="en" lang="en">
<head>
<title>Write your title here</title>
</head>
<body>

Put your stuff here

</body> </html>

Basic Syntax

Document Content

Requirements for Validating on the W3C's Validator

The <html> Tag

Document Header

The Document Body