INFOT 2 Chapter 4
INFOT 2 Chapter 4
Lesson 1:
HTML Introduction
What is HTML?
HTML is the standard markup language for creating
Web pages.
• HTML stands for Hyper Text Markup Language
• HTML describes the structure of Web pages using
markup
• HTML elements are the building blocks of HTML
pages
• HTML elements are represented by tags
• HTML tags label pieces of content such as "heading",
"paragraph", "table", and so on
• Browsers do not display the HTML tags, but use them
to render the content of the page
A Simple HTML Document
Example Explained
HTML Page Structure
Below is a visualization of an HTML page
structure:
Web Browsers
• The purpose of a web browser (Chrome, IE, Firefox,
Safari, etc.) is to read HTML documents and display
them.
• The browser does not display the HTML tags, but uses
them to determine how to display the document:
HTML Tags
HTML tags are element names surrounded by
angle brackets:
The <!DOCTYPE> Declaration
HTML Versions
HTML Editors
Write HTML Using Notepad or TextEdit
• Web pages can be created and modified by
using professional HTML editors.
• However, for learning HTML we recommend a
simple text editor like Notepad (PC) or
TextEdit (Mac).
• We believe using a simple text editor is a good
way to learn HTML.
Step 1: Open Notepad (PC)
The Notepad Window
Program Control
Title Bar Buttons
Menu Bar
Text Area
Scroll
Bar
Step 2: Write Some HTML
Step 3: Save the HTML Page
Step 4: View the HTML Page
in Your Browser
Open the saved HTML file in your favorite browser (double click
on the file, or right-click - and choose "Open with").
The result will look much like this:
HTML Basic Examples
HTML Documents
Example
HTML Headings
• HTML headings are defined with the <h1> to <h6> tags.
• <h1> defines the most important heading. <h6> defines the
least important heading:
HTML Paragraphs
HTML paragraphs are defined with the <p> tag:
HTML Links
HTML Images
HTML Buttons
HTML Lists
HTML Elements
Do Not Forget the End Tag
AVI .avi AVI (Audio Video Interleave). Developed by Microsoft. Commonly used in video cameras and TV
hardware. Plays well on Windows computers, but not in web browsers.
WMV .wmv WMV (Windows Media Video). Developed by Microsoft. Commonly used in video cameras and
TV hardware. Plays well on Windows computers, but not in web browsers.
QuickTime .mov QuickTime. Developed by Apple. Commonly used in video cameras and TV hardware. Plays well
on Apple computers, but not in web browsers. (See MP4)
RealVideo .rm RealVideo. Developed by Real Media to allow video streaming with low bandwidths. It is still
.ram used for online video and Internet TV, but does not play in web browsers.
Flash .swf Flash. Developed by Macromedia. Often requires an extra component (plug-in) to play in web
.flv browsers.
Ogg .ogg Theora Ogg. Developed by the Xiph.Org Foundation. Supported by HTML5.
WebM .webm WebM. Developed by the web giants, Mozilla, Opera, Adobe, and Google. Supported by HTML5.
MPEG-4 .mp4 MP4. Developed by the Moving Pictures Expert Group. Based on QuickTime. Commonly used in
or MP4 newer video cameras and TV hardware. Supported by all HTML5 browsers. Recommended by
YouTube.
Audio Formats
• MP3 is the newest format for
compressed recorded music. The term
MP3 has become synonymous with
digital music.
• If your website is about recorded music,
MP3 is the choice.
Format File Description
MIDI .mid MIDI (Musical Instrument Digital Interface). Main format for all
.midi electronic music devices like synthesizers and PC sound cards. MIDI
files do not contain sound, but digital notes that can be played by
electronics. Plays well on all computers and music hardware, but not
in web browsers.
RealAu .rm RealAudio. Developed by Real Media to allow streaming of audio with
dio .ram low bandwidths. Does not play in web browsers.
WMA .wma WMA (Windows Media Audio). Developed by Microsoft. Commonly
used in music players. Plays well on Windows computers, but not in
web browsers.
AAC .aac AAC (Advanced Audio Coding). Developed by Apple as the default
format for iTunes. Plays well on Apple computers, but not in web
browsers.
WAV .wav WAV. Developed by IBM and Microsoft. Plays well on Windows,
Macintosh, and Linux operating systems. Supported by HTML5.
Ogg .ogg Ogg. Developed by the Xiph.Org Foundation. Supported by HTML5.
MP3 .mp3 MP3 files are actually the sound part of MPEG files. MP3 is the most
popular format for music players. Combines good compression (small
files) with high quality. Supported by all browsers.
MP4 .mp4 MP4 is a video format, but can also be used for audio. MP4 video is
the upcoming video format on the internet. This leads to automatic
support for MP4 audio by all browsers.
HTML5 Video
Playing Videos in HTML
• Before HTML5, a video could only be played in
a browser with a plug-in (like flash).
• The HTML5 <video> element specifies a
standard way to embed a video in a web page.
Browser Support
• The numbers in the table specify the first
browser version that fully supports
the <video>element.
The HTML <video> Element
To show a video in HTML, use the <video> element:
<!DOCTYPE html> <script>
<html> var myVideo = document.getElementById("video1");
<body> function playPause() {
<div style="text-align:center"> if (myVideo.paused)
<button myVideo.play();
else
onclick="playPause()">Play/Pause</butto myVideo.pause();
n> }
<button
onclick="makeBig()">Big</button> function makeBig() {
myVideo.width = 560;
<button }
onclick="makeSmall()">Small</button>
<button function makeSmall() {
onclick="makeNormal()">Normal</button myVideo.width = 320;
}
>
<br><br> function makeNormal() {
<video id="video1" width="420"> myVideo.width = 420;
<source src="mov_bbb.mp4" }
</script>
type="video/mp4"> </body>
</video> </html>
</div>
How it Works
HTML Video - Media Types
HTML Video - Browser Support
Next Topic
Chapter 6