HTML Tutorial
HTML Tutorial
HTML Tutorial
Tutorial
❮ HomeNext ❯
HTML is the standard markup language for Web pages.
With our online HTML editor, you can edit the HTML, and click on a button to view the
result.
Example
<!DOCTYPE html>
<html>
<head>
<title>Page Title</title>
</head>
<body>
<h1>This is a Heading</h1>
<p>This is a paragraph.</p>
1
</body>
</html>
HTML Introduction
HTML is the standard markup language for creating Web pages.
What is HTML?
HTML stands for Hyper Text Markup Language
HTML describes the structure of a Web page
HTML consists of a series of elements
HTML elements tell the browser how to display the content
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
</body>
</html>
Example Explained
The <!DOCTYPE html> declaration defines this document to be HTML5
The <html> element is the root element of an HTML page
The <head> element contains meta information about the document
The <title> element specifies a title for the document
The <body> element contains the visible page content
The <h1> element defines a large heading
The <p> element defines a paragraph
HTML Tags
3
HTML tags are element names surrounded by angle brackets:
Tip: The start tag is also called the opening tag, and the end tag the closing tag.
Web Browsers
The purpose of a web browser (Chrome, Edge, Firefox, Safari) 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:
4
HTML Page Structure
Below is a visualization of an HTML page structure:
<html>
<head>
<title>Page title</title>
5
</head>
<body>
<h1>This is a heading</h1>
<p>This is a paragraph.</p>
</body>
</html>
Note: Only the content inside the <body> section (the white area above) is displayed
in a browser.
It must only appear once, at the top of the page (before any HTML tags).
<!DOCTYPE html>
6
HTML History
Since the early days of the World Wide Web, there have been many versions of HTML:
Year Version
7
1999 W3C Recommendation: HTML 4.01
8
This tutorial follows the latest HTML 5 standard.
HTML Editors
A simple text editor is all you need to learn HTML.
However, for learning HTML we recommend a simple text editor like Notepad (PC) or
TextEdit (Mac).
Follow the steps below to create your first web page with Notepad or TextEdit.
9
Open the Start Screen (the window symbol at the bottom left on your screen).
Type Notepad.
Windows 7 or earlier:
Then under "Open and Save", check the box that says "Display HTML files as HTML
code instead of formatted text".
<!DOCTYPE html>
<html>
10
<body>
</body>
</html>
You can use either .htm or .html as file extension. There is no difference, it is up to
you.
12
W3Schools Online Editor
With our free online editor, you can edit the HTML code and view the result in your
browser.
It is the perfect tool when you want to test code fast. It also has color coding and the
ability to save and share code with others:
13
Example
<!DOCTYPE html>
<html>
<head>
<title>Page Title</title>
</head>
<body>
<h1>This is a Heading</h1>
<p>This is a paragraph.</p>
</body>
</html>
HTML Basic Examples
In this chapter we will show some basic HTML examples.
Don't worry if we use tags you have not learned about yet.
14
HTML Documents
All HTML documents must start with a document type declaration: <!DOCTYPE html>.
Example
<!DOCTYPE html>
<html>
<body>
</body>
</html>
HTML Headings
HTML headings are defined with the <h1> to <h6> tags.
15
Example
<h1>This is heading 1</h1>
<h2>This is heading 2</h2>
<h3>This is heading 3</h3>
HTML Paragraphs
HTML paragraphs are defined with the <p> tag:
Example
<p>This is a paragraph.</p>
<p>This is another paragraph.</p>
HTML Links
HTML links are defined with the <a> tag:
Example
<a href="https://www.w3schools.com">This is a link</a>
16
The link's destination is specified in the href attribute.
HTML Images
HTML images are defined with the <img> tag.
Example
<img src="w3schools.jpg" alt="W3Schools.com" width="104" height="142">
HTML Buttons
HTML buttons are defined with the <button> tag:
Example
<button>Click me</button>
17
HTML Lists
HTML lists are defined with the <ul> (unordered/bullet list) or
the <ol> (ordered/numbered list) tag, followed by <li> tags (list items):
Example
<ul>
<li>Coffee</li>
<li>Tea</li>
<li>Milk</li>
</ul>
<ol>
<li>Coffee</li>
<li>Tea</li>
<li>Milk</li>
</ol>
HTML Elements
An HTML element is defined by a start tag, some content, and an end tag.
18
HTML Elements
An HTML element usually consists of a start tag and an end tag, with the content
inserted in between:
The HTML element is everything from the start tag to the end tag:
<br>
19
HTML elements with no content are called empty elements. Empty elements do not
have an end tag, such as the <br> element (which indicates a line break).
Example
<!DOCTYPE html>
<html>
<body>
</body>
</html>
Example Explained
20
The <html> element defines the whole document.
<html>
<body>
</body>
</html>
<body>
</body>
21
The element content is: My First Heading.
Example
<html>
<body>
<p>This is a paragraph
<p>This is a paragraph
</body>
</html>
22
The example above works in all browsers, because the closing tag is considered
optional.
Never rely on this. It might produce unexpected results and/or errors if you
forget the end tag.
<br> is an empty element without a closing tag (the <br> tag defines a line break):
Example
<p>This is a <br> paragraph with a line break.</p>
Empty elements can be "closed" in the opening tag like this: <br />.
HTML does not require empty elements to be closed. But if you want stricter
validation, or if you need to make your document readable by XML parsers, you must
close all HTML elements properly.
HTML Attributes
An HTML attribute provides additional information about an HTML element.
HTML Attributes
All HTML elements can have attributes
Attributes provide additional information about an element
Attributes are always specified in the start tag
Attributes usually come in name/value pairs like: name="value"
24
HTML links are defined with the <a> tag. The link address is specified in
the href attribute:
Example
<a href="https://www.w3schools.com">This is a link</a>
You will learn more about links and the <a> tag later in this tutorial.
Example
<img src="img_girl.jpg">
25
Example
<img src="img_girl.jpg" width="500" height="600">
The width and height are specified in pixels by default; so width="500" means 500
pixels wide.
The value of the alt attribute can be read by screen readers. This way, someone
"listening" to the webpage, e.g. a vision impaired person, can "hear" the element.
Example
<img src="img_girl.jpg" alt="Girl with a jacket">
The alt attribute is also useful if the image cannot be displayed (e.g. if it does not
exist):
Example
26
See what happens if we try to display an image that does not exist:
Example
<p style="color:red">This is a red paragraph.</p>
You will learn more about styling later in this tutorial, and in our CSS Tutorial.
27
<!DOCTYPE html>
<html lang="en-US">
<body>
...
</body>
</html>
The first two letters specify the language (en). If there is a dialect, add two more
letters (US).
Example
<p title="I'm a tooltip">
This is a paragraph.
</p>
28
The title attribute can be written with uppercase or lowercase like title or TITLE.
Bad
<a href=https://www.w3schools.com>
Good
<a href="https://www.w3schools.com">
29
Sometimes it is necessary to use quotes. This example will not display the title
attribute correctly, because it contains a space:
Example
<p title=About W3Schools>
Using quotes are the most common. Omitting quotes can produce errors.
At W3Schools we always use quotes around attribute values.
In some situations, when the attribute value itself contains double quotes, it is
necessary to use single quotes:
Or vice versa:
Chapter Summary
30
All HTML elements can have attributes
The title attribute provides additional "tool-tip" information
The href attribute provides address information for links
The width and height attributes provide size information for images
The alt attribute provides text for screen readers
At W3Schools we always use lowercase attribute names
At W3Schools we always quote attribute values
HTML Attributes
Below is an alphabetical list of some attributes often used in HTML, which you will
learn more about in this tutorial:
Attribute Description
alt Specifies an alternative text for an image, when the image cannot be
displayed
31
href Specifies the URL (web address) for a link
HTML Headings
HTML headings are titles or subtitles that you want to display on a webpage.
32
Example
Heading 1
Heading 2
Heading 3
Heading 4
Heading 5
Heading 6
HTML Headings
HTML headings are defined with the <h1> to <h6> tags.
Example
<h1>Heading 1</h1>
<h2>Heading 2</h2>
<h3>Heading 3</h3>
33
<h4>Heading 4</h4>
<h5>Heading 5</h5>
<h6>Heading 6</h6>
Note: Browsers automatically add some white space (a margin) before and after a
heading.
Users often skim a page by its headings. It is important to use headings to show the
document structure.
<h1> headings should be used for main headings, followed by <h2> headings, then the
less important <h3>, and so on.
Note: Use HTML headings for headings only. Don't use headings to make
text BIG or bold.
Bigger Headings
Each HTML heading has a default size. However, you can specify the size for any
heading with the style attribute, using the CSS font-size property:
34
Example
<h1 style="font-size:60px;">Heading 1</h1>
Example
<h1>This is heading 1</h1>
<p>This is some text.</p>
<hr>
<h2>This is heading 2</h2>
<p>This is some other text.</p>
<hr>
Example
<!DOCTYPE html>
<html>
<head>
<title>My First HTML</title>
<meta charset="UTF-8">
</head>
<body>
.
.
.
Note: Metadata typically define the document title, character set, styles, scripts, and
other meta information.
36
View HTML Source Code:
Right-click in an HTML page and select "View Page Source" (in Chrome) or "View
Source" (in Edge), or similar in other browsers. This will open a window containing the
HTML source code of the page.
You will learn more about HTML tags and attributes in the next chapters of this
tutorial.
Tag Description
37
<body> Defines the document's body
<head> A container for all the head elements (title, scripts, styles, meta
information, and more)
HTML Paragraphs
A paragraph always starts on a new line, and is usually a block of text.
HTML Paragraphs
38
The HTML <p> element defines a paragraph.
A paragraph always starts on a new line, and browsers automatically add some white
space (a margin) before and after a paragraph.
Example
<p>This is a paragraph.</p>
<p>This is another paragraph.</p>
HTML Display
You cannot be sure how HTML will be displayed.
Large or small screens, and resized windows will create different results.
With HTML, you cannot change the output by adding extra spaces or extra lines in
your HTML code.
The browser will remove any extra spaces and extra lines when the page is displayed:
Example
<p>
This paragraph
contains a lot of lines
in the source code,
but the browser
39
ignores it.
</p>
<p>
This paragraph
contains a lot of spaces
in the source code,
but the browser
ignores it.
</p>
Example
<p>This is a paragraph.
<p>This is another paragraph.
The example above will work in most browsers, but do not rely on it.
40
HTML Line Breaks
The HTML <br> element defines a line break.
Use <br> if you want a line break (a new line) without starting a new paragraph:
Example
<p>This is<br>a paragraph<br>with line breaks.</p>
Example
<p>
My Bonnie lies over the ocean.
41
Oh, bring back my Bonnie to me.
</p>
The text inside a <pre> element is displayed in a fixed-width font (usually Courier), and
it preserves both spaces and line breaks:
Example
<pre>
My Bonnie lies over the ocean.
Tag Description
HTML Styles
The HTML style attribute is used to add styles to an element, such as color, font,
size, and more.
43
Example
I am Red
I am Blue
I am Big
<tagname style="property:value;">
Background Color
The CSS background-color property defines the background color for an HTML element.
44
This example sets the background color for a page to powderblue:
Example
<body style="background-color:powderblue;">
<h1>This is a heading</h1>
<p>This is a paragraph.</p>
</body>
Text Color
The CSS color property defines the text color for an HTML element:
Example
<h1 style="color:blue;">This is a heading</h1>
<p style="color:red;">This is a paragraph.</p>
Fonts
The CSS font-family property defines the font to be used for an HTML element:
Example
45
<h1 style="font-family:verdana;">This is a heading</h1>
<p style="font-family:courier;">This is a paragraph.</p>
Text Size
The CSS font-size property defines the text size for an HTML element:
Example
<h1 style="font-size:300%;">This is a heading</h1>
<p style="font-size:160%;">This is a paragraph.</p>
Text Alignment
The CSS text-align property defines the horizontal text alignment for an HTML
element:
Example
<h1 style="text-align:center;">Centered Heading</h1>
<p style="text-align:center;">Centered paragraph.</p>
46
Chapter Summary
Use the style attribute for styling HTML elements
Use background-color for background color
Use color for text colors
Use font-family for text fonts
Use font-size for text sizes
Use text-align for text alignment
HTML Text Formatting
HTML contains several elements for defining text with a special meaning.
Example
This text is bold
This is subscript and superscript
47
HTML Formatting Elements
Formatting elements were designed to display special types of text:
Example
<b>This text is bold</b>
48
Example
<strong>This text is strong</strong>
Example
<i>This text is italic</i>
Example
<em>This text is emphasized</em>
49
The HTML <small> element defines smaller text:
Example
<h2>HTML <small>Small</small> Formatting</h2>
Example
<h2>HTML <mark>Marked</mark> Formatting</h2>
Example
<p>My favorite color is <del>blue</del> red.</p>
50
HTML <ins> Element
The HTML <ins> element defines inserted/added text.
Example
<p>My favorite <ins>color</ins> is red.</p>
Example
<p>This is <sub>subscripted</sub> text.</p>
Example
<p>This is <sup>superscripted</sup> text.</p>
51
HTML Text Formatting Elements
Tag Description
52
<sup> Defines superscripted text
53
Example
Here is a quote from WWF's website:
For nearly 60 years, WWF has been protecting the future of nature. The world's
leading conservation organization, WWF works in 100 countries and is supported by
more than one million members in the United States and close to five million globally.
Example
<p>WWF's goal is to: <q>Build a future where people live in harmony with
nature.</q></p>
54
Example
<p>Here is a quote from WWF's website:</p>
<blockquote cite="http://www.worldwildlife.org/who/index.html">
For 50 years, WWF has been protecting the future of nature.
The world's leading conservation organization,
WWF works in 100 countries and is supported by
1.2 million members in the United States and
close to 5 million globally.
</blockquote>
Example
<p>The <abbr title="World Health Organization">WHO</abbr> was founded in
1948.</p>
The <address> element is usually displayed in italic. Most browsers will add a line break
before and after the element.
Example
<address>
Written by John Doe.<br>
Visit us at:<br>
Example.com<br>
Box 564, Disneyland<br>
USA
</address>
Example
<p><cite>The Scream</cite> by Edvard Munch. Painted in 1893.</p>
56
HTML <bdo> for Bi-Directional Override
The HTML <bdo> element defines bi-directional override.
Example
<bdo dir="rtl">This text will be written from right to left</bdo>
57
<blockquote> Defines a section that is quoted from another source
HTML Comments
HTML comments are not displayed in the browser, but they can help document
your HTML source code.
58
Notice that there is an exclamation point (!) in the opening tag, but not in the closing
tag.
Note: Comments are not displayed by the browser, but they can help document your
HTML source code.
With comments you can place notifications and reminders in your HTML:
Example
<!-- This is a comment -->
<p>This is a paragraph.</p>
Comments are also great for debugging HTML, because you can comment out HTML
lines of code, one at a time, to search for errors:
Example
<!-- Do not display this image at the moment
<img border="0" src="pic_trulli.jpg" alt="Trulli">
-->
HTML Colors
59
HTML colors are specified using predefined color names, or RGB, HEX, HSL, RGBA,
HSLA values.
Color Names
In HTML, a color can be specified by using a color name:
Tomato
Orange
DodgerBlue
MediumSeaGreen
60
Gray
SlateBlue
Violet
LightGray
Background Color
You can set the background color for HTML elements:
Hello World
61
Lorem ipsum dolor sit amet, consectetuer adipiscing elit, sed diam nonummy nibh
euismod tincidunt ut laoreet dolore magna aliquam erat volutpat. Ut wisi enim ad
minim veniam, quis nostrud exerci tation ullamcorper suscipit lobortis nisl ut aliquip
ex ea commodo consequat.
Example
<h1 style="background-color:DodgerBlue;">Hello World</h1>
<p style="background-color:Tomato;">Lorem ipsum...</p>
Text Color
You can set the color of text:
Hello World
Lorem ipsum dolor sit amet, consectetuer adipiscing elit, sed diam nonummy nibh
euismod tincidunt ut laoreet dolore magna aliquam erat volutpat.
Ut wisi enim ad minim veniam, quis nostrud exerci tation ullamcorper suscipit lobortis
nisl ut aliquip ex ea commodo consequat.
Example
<h1 style="color:Tomato;">Hello World</h1>
<p style="color:DodgerBlue;">Lorem ipsum...</p>
<p style="color:MediumSeaGreen;">Ut wisi enim...</p>
62
Border Color
You can set the color of borders:
Hello World
Hello World
Hello World
Example
<h1 style="border:2px solid Tomato;">Hello World</h1>
<h1 style="border:2px solid DodgerBlue;">Hello World</h1>
<h1 style="border:2px solid Violet;">Hello World</h1>
Color Values
In HTML, colors can also be specified using RGB values, HEX values, HSL values,
RGBA values, and HSLA values:
63
rgb(255, 99, 71)
#ff6347
Example
<h1 style="background-color:rgb(255, 99, 71);">...</h1>
<h1 style="background-color:#ff6347;">...</h1>
<h1 style="background-color:hsl(9, 100%, 64%);">...</h1>
64
HTML RGB and RGBA Colors
❮ PreviousNext ❯
An RGB color value represents RED, GREEN, and BLUE light sources.
rgb(red, green, blue)
Each parameter (red, green, and blue) defines the intensity of the color between 0
and 255.
For example, rgb(255, 0, 0) is displayed as red, because red is set to its highest value
(255) and the others are set to 0.
65
To display black, set all color parameters to 0, like this: rgb(0, 0, 0).
To display white, set all color parameters to 255, like this: rgb(255, 255, 255).
RED
255
GREEN
99
BLUE
71
Example
rgb(255, 0, 0)
66
rgb(0, 0, 255)
rgb(255, 165, 0)
Try it Yourself »
Shades of gray are often defined using equal values for all the 3 light sources:
Example
67
rgb(0, 0, 0)
Try it Yourself »
68
RGBA Color Values
RGBA color values are an extension of RGB color values with an alpha channel - which
specifies the opacity for a color.
rgba(red, green, blue, alpha)
The alpha parameter is a number between 0.0 (fully transparent) and 1.0 (not
transparent at all):
69
HTML HEX Colors
A hexadecimal color is specified with: #RRGGBB, where the RR (red), GG (green)
and BB (blue) hexadecimal integers specify the components of the color.
#rrggbb
Where rr (red), gg (green) and bb (blue) are hexadecimal values between 00 and ff
(same as decimal 0-255).
For example, #ff0000 is displayed as red, because red is set to its highest value (ff)
and the others are set to the lowest value (00).
#ff6347
RED
ff
GREEN
63
BLUE
47
Example
71
#ff0000
#0000ff
#3cb371
#ee82ee
#ffa500
#6a5acd
72
Shades of gray are often defined using equal values for all the 3 light sources:
Example
#000000
#3c3c3c
#787878
#b4b4b4
#f0f0f0
73
#ffffff
HSLA color values are an extension of HSL with an Alpha channel (opacity).
74
hsl(hue, saturation, lightness)
Hue is a degree on the color wheel from 0 to 360. 0 is red, 120 is green, and 240 is
blue.
Saturation is a percentage value, 0% means a shade of gray, and 100% is the full
color.
HUE
SATURATION
100%
LIGHTNESS
50%
Example
75
hsl(0, 100%, 50%)
Try it Yourself »
76
Saturation
Saturation can be described as the intensity of a color.
50% is 50% gray, but you can still see the color.
Example
77
hsl(0, 40%, 50%)
Try it Yourself »
Lightness
The lightness of a color can be described as how much light you want to give the
color, where 0% means no light (black), 50% means 50% light (neither dark nor
light) 100% means full lightness (white).
Example
78
hsl(0, 100%, 0%)
Try it Yourself »
79
Shades of gray are often defined by setting the hue and saturation to 0, and adjust
the lightness from 0% to 100% to get darker/lighter shades:
Example
80
hsl(0, 0%, 100%)
Try it Yourself »
hsla(hue, saturation, lightness, alpha)
The alpha parameter is a number between 0.0 (fully transparent) and 1.0 (not
transparent at all):
HUE
81
0
SATURATION
100%
LIGHTNESS
50%
ALPHA
0.5
Example
82
hsla(9, 100%, 64%, 0.6)
HTML Styles - CSS
CSS stands for Cascading Style Sheets.
CSS saves a lot of work. It can control the layout of multiple web pages all at
once.
The most common way to add CSS, is to keep the styles in separate CSS files.
However, here we will use inline and internal styling, because this is easier to
demonstrate, and easier for you to try it yourself.
Inline CSS
An inline CSS is used to apply a unique style to a single HTML element.
84
This example sets the text color of the <h1> element to blue:
Example
<h1 style="color:blue;">This is a Blue Heading</h1>
Internal CSS
An internal CSS is used to define a style for a single HTML page.
Example
<!DOCTYPE html>
<html>
<head>
<style>
body {background-color: powderblue;}
h1 {color: blue;}
p {color: red;}
</style>
</head>
<body>
<h1>This is a heading</h1>
<p>This is a paragraph.</p>
85
</body>
</html>
External CSS
An external style sheet is used to define the style for many HTML pages.
With an external style sheet, you can change the look of an entire web site,
by changing one file!
To use an external style sheet, add a link to it in the <head> section of the HTML page:
Example
<!DOCTYPE html>
<html>
<head>
<link rel="stylesheet" href="styles.css">
</head>
<body>
<h1>This is a heading</h1>
<p>This is a paragraph.</p>
</body>
</html>
86
An external style sheet can be written in any text editor. The file must not contain any
HTML code, and must be saved with a .css extension.
body {
background-color: powderblue;
}
h1 {
color: blue;
}
p {
color: red;
}
CSS Fonts
The CSS color property defines the text color to be used.
Example
<!DOCTYPE html>
<html>
<head>
<style>
87
h1 {
color: blue;
font-family: verdana;
font-size: 300%;
}
p {
color: red;
font-family: courier;
font-size: 160%;
}
</style>
</head>
<body>
<h1>This is a heading</h1>
<p>This is a paragraph.</p>
</body>
</html>
CSS Border
The CSS border property defines a border around an HTML element:
Example
p {
border: 1px solid powderblue;
}
88
CSS Padding
The CSS padding property defines a padding (space) between the text and the
border:
Example
p {
border: 1px solid powderblue;
padding: 30px;
}
CSS Margin
The CSS margin property defines a margin (space) outside the border:
Example
p {
border: 1px solid powderblue;
margin: 50px;
}
89
The id Attribute
To define a specific style for one special element, add an id attribute to the element:
<p id="p01">I am different</p>
then define a style for the element with the specific id:
Example
#p01 {
color: blue;
}
Note: The id of an element should be unique within a page, so the id selector is used
to select one unique element!
<p class="error">I am different</p>
then define a style for the elements with the specific class:
Example
90
p.error {
color: red;
}
External References
External style sheets can be referenced with a full URL or with a path relative to the
current web page.
Example
<link rel="stylesheet" href="https://www.w3schools.com/html/styles.css">
This example links to a style sheet located in the html folder on the current web site:
Example
<link rel="stylesheet" href="/html/styles.css">
This example links to a style sheet located in the same folder as the current page:
Example
<link rel="stylesheet" href="styles.css">
91
Chapter Summary
Use the HTML style attribute for inline styling
Use the HTML <style> element to define internal CSS
Use the HTML <link> element to refer to an external CSS file
Use the HTML <head> element to store <style> and <link> elements
Use the CSS color property for text colors
Use the CSS font-family property for text fonts
Use the CSS font-size property for text sizes
Use the CSS border property for borders
Use the CSS padding property for space inside the border
Use the CSS margin property for space outside the border
92
HTML Links
Links are found in nearly all web pages. Links allow users to click their way from
page to page.
When you move the mouse over a link, the mouse arrow will turn into a little hand.
Note: A link does not have to be text. It can be an image or any other HTML element.
93
HTML Links - Syntax
Hyperlinks are defined with the HTML <a> tag:
<a href="url">link text</a>
Example
<a href="https://www.w3schools.com/html/">Visit our HTML tutorial</a>
Clicking on the link text will send you to the specified address.
Note: Without a forward slash at the end of subfolder addresses, you might generate
two requests to the server. Many servers will automatically add a forward slash to the
end of the address, and then create a new request.
Local Links
The example above used an absolute URL (a full web address).
94
A local link (link to the same web site) is specified with a relative URL (without
https://www....).
Example
<a href="html_images.asp">HTML Images</a>
This example will open the linked document in a new browser window/tab:
Example
<a href="https://www.w3schools.com/" target="_blank">Visit W3Schools!</a>
Tip: If your webpage is locked in a frame, you can use target="_top" to break out of
the frame:
95
Example
<a href="https://www.w3schools.com/html/" target="_top">HTML tutorial!</a>
Example
<a href="default.asp">
<img src="smiley.gif" alt="HTML
tutorial" style="width:42px;height:42px;border:0;">
</a>
Button as a Link
To use an HTML button as a link, you have to add some JavaScript code.
JavaScript allows you to specify what happens at certain events, such as a click of a
button:
96
Example
<button onclick="document.location = 'default.asp'">HTML Tutorial</button>
Link Titles
The title attribute specifies extra information about an element. The information is
most often shown as a tooltip text when the mouse moves over the element.
Example
<a href="https://www.w3schools.com/html/" title="Go to W3Schools HTML
section">Visit our HTML Tutorial</a>
External Paths
External pages can be referenced with a full URL or with a path relative to the current
web page.
Example
97
<a href="https://www.w3schools.com/html/default.asp">HTML tutorial</a>
This example links to a page located in the html folder on the current web site:
Example
<a href="/html/default.asp">HTML tutorial</a>
This example links to a page located in the same folder as the current page:
Example
<a href="default.asp">HTML tutorial</a>
Chapter Summary
Use the <a> element to define a link
Use the href attribute to define the link address
Use the target attribute to define where to open the linked document
Use the <img> element (inside <a>) to use an image as a link
98
HTML Link Tags
Tag Description
99
You can change the default colors, by using CSS:
Example
<style>
a:link {
color: green;
background-color: transparent;
text-decoration: none;
}
a:visited {
color: pink;
background-color: transparent;
text-decoration: none;
}
a:hover {
color: red;
background-color: transparent;
text-decoration: underline;
}
a:active {
color: yellow;
background-color: transparent;
text-decoration: underline;
}
</style>
100
Link Buttons
A link can also be styled as a button, by using CSS:
This is a link
Example
<style>
a:link, a:visited {
background-color: #f44336;
color: white;
padding: 15px 25px;
text-align: center;
text-decoration: none;
display: inline-block;
}
a:hover, a:active {
background-color: red;
}
</style>
101
<a> Defines a hyperlink
To create a bookmark - first create the bookmark, then add a link to it.
When the link is clicked, the page will scroll down or up to the location with the
bookmark.
Example
First, create a bookmark with the id attribute:
102
<h2 id="C4">Chapter 4</h2>
Then, add a link to the bookmark ("Jump to Chapter 4"), from within the same page:
Example
<a href="#C4">Jump to Chapter 4</a>
Chapter Summary
Use the id attribute (id="value") to define bookmarks in a page
Use the href attribute (href="#value") to link to the bookmark
103
<a> Defines a hyperlink
HTML Images
Images can improve the design and the appearance of a web page.
Example
<img src="pic_trulli.jpg" alt="Italian Trulli">
Example
<img src="img_girl.jpg" alt="Girl in a jacket">
Example
<img src="img_chania.jpg" alt="Flowers in Chania">
104
The <img> tag is empty, it contains attributes only, and does not have a closing tag.
<img src="url">
Example
<img src="img_chania.jpg" alt="Flowers in Chania">
Example
<img src="wrongname.gif" alt="Flowers in Chania">
Note: The alt attribute is required. A web page will not validate correctly without it.
105
Image Size - Width and Height
You can use the style attribute to specify the width and height of an image.
Example
<img src="img_girl.jpg" alt="Girl in a
jacket" style="width:500px;height:600px;">
Example
<img src="img_girl.jpg" alt="Girl in a jacket" width="500" height="600">
Note: Always specify the width and height of an image. If width and height are not
specified, the page might flicker while the image loads.
106
The width, height, and style attributes are valid in HTML.
Example
<!DOCTYPE html>
<html>
<head>
<style>
img {
width: 100%;
}
</style>
</head>
<body>
<img src="html5.gif" alt="HTML5 Icon" width="128" height="128">
<img src="html5.gif" alt="HTML5 Icon" style="width:128px;height:128px;">
</body>
</html>
107
However, it is common to store images in a sub-folder. You must then include the
folder name in the src attribute:
Example
<img src="/images/html5.gif" alt="HTML5
Icon" style="width:128px;height:128px;">
Actually, you can access images from any web address in the world:
Example
<img src="https://www.w3schools.com/images/w3schools_green.jpg" al
t="W3Schools.com">
Animated Images
HTML allows animated GIFs:
Example
108
<img src="programming.gif" alt="Computer Man" style="width:48px;height:48px;">
Image as a Link
To use an image as a link, put the <img> tag inside the <a> tag:
Example
<a href="default.asp">
<img src="smiley.gif" alt="HTML
tutorial" style="width:42px;height:42px;border:0;">
</a>
Note: border:0; is added to prevent IE9 (and earlier) from displaying a border around
the image (when the image is a link).
Image Floating
Use the CSS float property to let the image float to the right or to the left of a text:
Example
<p><img src="smiley.gif" alt="Smiley
face" style="float:right;width:42px;height:42px;">
The image will float to the right of the text.</p>
109
<p><img src="smiley.gif" alt="Smiley
face" style="float:left;width:42px;height:42px;">
The image will float to the left of the text.</p>
Chapter Summary
Use the HTML <img> element to define an image
Use the HTML src attribute to define the URL of the image
Use the HTML alt attribute to define an alternate text for an image, if it cannot
be displayed
Use the HTML width and height attributes to define the size of the image
Use the CSS width and height properties to define the size of the image
(alternatively)
Use the CSS float property to let the image float
HTML Image Maps
With HTML image-maps, you can create clickable areas on an image.
111
Image Maps
The <map> tag defines an image-map. An image-map is an image with clickable areas.
Click on the computer, the phone, or the cup of coffee in the image below:
Example
<img src="workplace.jpg" alt="Workplace" usemap="#workmap">
<map name="workmap">
112
<area shape="rect" coords="34,44,270,350" alt="Computer" href="computer.htm">
<area shape="rect" coords="290,172,333,250" alt="Phone" href="phone.htm">
<area shape="circle" coords="337,300,44" alt="Coffee" href="coffee.htm">
</map>
To create an image map you need an image, and a map containing some rules that
describe the clickable areas.
The Image
The image is inserted using the <img> tag. The only difference from other images is
that you must add a usemap attribute:
<img src="workplace.jpg" alt="Workplace" usemap="#workmap">
The usemap value starts with a hash tag # followed by the name of the image map,
and is used to create a relationship between the image and the image map.
113
The Map
Then add a <map> element.
<map name="workmap">
Note: You may insert the <map> element anywhere you like, it does not have to be
inserted right after the image.
The Areas
Then add the clickable areas.
Shape
You must define the shape of the area, and you can choose one of these values:
114
default - defines the entire region
Coordinates
You must define some coordinates to be able to place the clickable area onto the
image.
The coordinates come in pairs, one for the x-axis and one for the y-axis.
The coordinates 34, 44 is located 34 pixels from the left margin and 44 pixels from
the top:
115
The coordinates 270, 350 is located 270 pixels from the left margin and 350 pixels
from the top:
This is the area that becomes clickable and will send the user to the page
computer.htm:
116
Circle
To add a circle area, first locate the coordinates of the center of the circle:
337, 300
117
Then specify the radius of the circle:
44 pixels
118
Now you have enough data to create a clickable circular area:
This is the area that becomes clickable and will send the user to the page coffee.htm:
119
Image Map and JavaScript
A clickable area does not have to be a link to another page, it can also trigger a
JavaScript function.
120
Example
You can use the onclick attribute to execute a JavaScript function when the area is
clicked
<area shape="circle" coords="337,300,44" onclick="myFunction()">
Chapter Summary
Use the HTML <map> element to define an image-map
Use the HTML <area> element to define the clickable areas in the image-map
Use the HTML <img>'s element usemap attribute to point to an image-map
HTML Background Images
A background image can be specified on almost any HTML element.
121
To add a background image on an HTML element, use the HTML style attribute and
the CSS background-image property:
Example
Add a background image on a HTML element:
<div style="background-image: url('img_girl.jpg');">
Example
Specify the background image in the style element:
<style>
div {
background-image: url('img_girl.jpg');
}
</style>
122
Example
Add a background image on a HTML page:
<style>
body {
background-image: url('img_girl.jpg');
}
</style>
Background Repeat
If the background image is smaller than the element, the image will repeat itself,
horizontally and vertically, until it reaches the end of the element:
Example
<style>
body {
background-image: url('example_img_girl.jpg');
}
</style>
123
Example
<style>
body {
background-image: url('example_img_girl.jpg');
background-repeat: no-repeat;
}
</style>
Background Cover
If you want the background image cover the entire element, you can set
the background-size property to cover.
Also, to make sure the entire element is always covered, set the background-
attachment property to fixed:
As you can see, the image will cover the entire element, with no stretching, the image
will keep its original proportions.
Example
<style>
body {
background-image: url('img_girl.jpg');
background-repeat: no-repeat;
background-attachment: fixed;
background-size: cover;
124
}
</style>
Background Stretch
If you want the background image stretch to fit the entire image in the element, you
can set the background-size property to 100% 100%:
Try resizing the browser window, and you will see that the image will stretch, but
always cover the entire element.
Example
<style>
body {
background-image: url('img_girl.jpg');
background-repeat: no-repeat;
background-attachment: fixed;
background-size: 100% 100%;
}
</style>
125
From the examples above you have learned that background images can be styled by
using the CSS background properties.
HTML Picture Element
The HTML <picture> element allows us to display different pictures for different
devices or screen sizes.
126
The HTML <picture> Element
The <picture> element gives us more flexibility when specifying image resources.
127
Example
Show different images on different screen sizes:
<picture>
<source media="(min-width: 650px)" srcset="img_food.jpg">
<source media="(min-width: 465px)" srcset="img_car.jpg">
<img src="img_girl.jpg">
</picture>
1. Bandwidth
If you have a small screen or device, it is not necessary to load a large image file. The
browser will use the first <source> element with matching attribute values, and ignore
any of the following elements.
2. Format Support
128
Some browsers or devices may not support all image formats. By using
the <picture> element, you can add images of all formats, and the browser will use the
first format it recognizes and ignore any of the following.
Example
The browser will use the first image format it recognizes:
<picture>
<source srcset="img_avatar.png">
<source srcset="img_girl.jpg">
<img src="img_beatles.gif" alt="Beatles" style="width:auto;">
</picture>
Note: The browser will use the first <source> element with matching attribute values,
and ignore any following <source> elements.
HTML Tables
HTML tables allow web authors to arrange data into rows and columns.
Example
129
Company Contact Country
Each table row is defined with the <tr> tag. A table header is defined with the <th> tag.
By default, table headings are bold and centered. A table data/cell is defined with
the <td> tag.
Example
<table style="width:100%">
<tr>
<th>Firstname</th>
<th>Lastname</th>
<th>Age</th>
130
</tr>
<tr>
<td>Jill</td>
<td>Smith</td>
<td>50</td>
</tr>
<tr>
<td>Eve</td>
<td>Jackson</td>
<td>94</td>
</tr>
</table>
Example
table, th, td {
border: 1px solid black;
}
131
Remember to define borders for both the table and the table cells.
Example
table, th, td {
border: 1px solid black;
border-collapse: collapse;
}
If you do not specify a padding, the table cells will be displayed without padding.
Example
132
th, td {
padding: 15px;
}
Example
th {
text-align: left;
}
Example
133
table {
border-spacing: 5px;
}
Example
<table style="width:100%">
<tr>
<th>Name</th>
<th colspan="2">Telephone</th>
</tr>
<tr>
<td>Bill Gates</td>
<td>55577854</td>
<td>55577855</td>
</tr>
</table>
Example
<table style="width:100%">
<tr>
<th>Name:</th>
<td>Bill Gates</td>
</tr>
<tr>
<th rowspan="2">Telephone:</th>
<td>55577854</td>
</tr>
<tr>
<td>55577855</td>
</tr>
</table>
Example
<table style="width:100%">
<caption>Monthly savings</caption>
<tr>
<th>Month</th>
<th>Savings</th>
</tr>
135
<tr>
<td>January</td>
<td>$100</td>
</tr>
<tr>
<td>February</td>
<td>$50</td>
</tr>
</table>
Example
<table id="t01">
<tr>
<th>Firstname</th>
<th>Lastname</th>
<th>Age</th>
</tr>
<tr>
<td>Eve</td>
<td>Jackson</td>
<td>94</td>
136
</tr>
</table>
Chapter Summary
Use the HTML <table> element to define a table
Use the HTML <tr> element to define a table row
Use the HTML <td> element to define a table data
Use the HTML <th> element to define a table heading
Use the HTML <caption> element to define a table caption
137
Use the CSS border property to define a border
Use the CSS border-collapse property to collapse cell borders
Use the CSS padding property to add padding to cells
Use the CSS text-align property to align cell text
Use the CSS border-spacing property to set the spacing between cells
Use the colspan attribute to make a cell span many columns
Use the rowspan attribute to make a cell span many rows
Use the id attribute to uniquely define one table
138
<caption> Defines a table caption
139
HTML Lists
HTML lists allow web authors to group a set of related items in lists.
Example
An unordered HTML list:
Item
Item
Item
Item
1. First item
2. Second item
3. Third item
4. Fourth item
140
The list items will be marked with bullets (small black circles) by default:
Example
<ul>
<li>Coffee</li>
<li>Tea</li>
<li>Milk</li>
</ul>
Example
<ol>
<li>Coffee</li>
<li>Tea</li>
<li>Milk</li>
</ol>
The <dl> tag defines the description list, the <dt> tag defines the term (name), and
the <dd> tag describes each term:
Example
<dl>
<dt>Coffee</dt>
<dd>- black hot drink</dd>
<dt>Milk</dt>
<dd>- white cold drink</dd>
</dl>
HTML Unordered Lists
The HTML <ul> tag defines an unordered (bulleted) list.
142
The list items will be marked with bullets (small black circles) by default:
Example
<ul>
<li>Coffee</li>
<li>Tea</li>
<li>Milk</li>
</ul>
Value Description
143
square Sets the list item marker to a square
Example - Disc
<ul style="list-style-type:disc;">
<li>Coffee</li>
<li>Tea</li>
<li>Milk</li>
</ul>
Example - Circle
<ul style="list-style-type:circle;">
<li>Coffee</li>
<li>Tea</li>
<li>Milk</li>
</ul>
Example - Square
<ul style="list-style-type:square;">
<li>Coffee</li>
<li>Tea</li>
<li>Milk</li>
</ul>
144
Example - None
<ul style="list-style-type:none;">
<li>Coffee</li>
<li>Tea</li>
<li>Milk</li>
</ul>
Example
<ul>
<li>Coffee</li>
<li>Tea
<ul>
<li>Black tea</li>
<li>Green tea</li>
</ul>
</li>
<li>Milk</li>
</ul>
Note: List items can contain new list, and other HTML elements, like images and
links, etc.
145
Horizontal List with CSS
HTML lists can be styled in many different ways with CSS.
Example
<!DOCTYPE html>
<html>
<head>
<style>
ul {
list-style-type: none;
margin: 0;
padding: 0;
overflow: hidden;
background-color: #333333;
}
li {
float: left;
}
li a {
display: block;
color: white;
text-align: center;
padding: 16px;
text-decoration: none;
}
146
li a:hover {
background-color: #111111;
}
</style>
</head>
<body>
<ul>
<li><a href="#home">Home</a></li>
<li><a href="#news">News</a></li>
<li><a href="#contact">Contact</a></li>
<li><a href="#about">About</a></li>
</ul>
</body>
</html>
Chapter Summary
Use the HTML <ul> element to define an unordered list
Use the CSS list-style-type property to define the list item marker
Use the HTML <li> element to define a list item
Lists can be nested inside lists
List items can contain other HTML elements
Use the CSS property float:left or display:inline to display a list horizontally
147
HTML Ordered Lists
The HTML <ol> tag defines an ordered list. An ordered list can be numerical or
alphabetical.
Example
<ol>
<li>Coffee</li>
<li>Tea</li>
<li>Milk</li>
</ol>
148
Type Description
type="I" The list items will be numbered with uppercase roman numbers
type="i" The list items will be numbered with lowercase roman numbers
Numbers:
<ol type="1">
<li>Coffee</li>
<li>Tea</li>
<li>Milk</li>
</ol>
149
Uppercase Letters:
<ol type="A">
<li>Coffee</li>
<li>Tea</li>
<li>Milk</li>
</ol>
Lowercase Letters:
<ol type="a">
<li>Coffee</li>
<li>Tea</li>
<li>Milk</li>
</ol>
150
<li>Milk</li>
</ol>
Example
<ol start="50">
<li>Coffee</li>
<li>Tea</li>
<li>Milk</li>
</ol>
Example
<ol>
<li>Coffee</li>
<li>Tea
<ol>
151
<li>Black tea</li>
<li>Green tea</li>
</ol>
</li>
<li>Milk</li>
</ol>
Note: List items can contain new list, and other HTML elements, like images and
links, etc.
Chapter Summary
Use the HTML <ol> element to define an ordered list
Use the HTML type attribute to define the numbering type
Use the HTML <li> element to define a list item
Lists can be nested inside lists
List items can contain other HTML elements
HTML Other Lists
HTML also supports description lists.
152
HTML Description Lists
A description list is a list of terms, with a description of each term.
The <dl> tag defines the description list, the <dt> tag defines the term (name), and
the <dd> tag describes each term:
Example
<dl>
<dt>Coffee</dt>
<dd>- black hot drink</dd>
<dt>Milk</dt>
<dd>- white cold drink</dd>
</dl>
Chapter Summary
Use the HTML <dl> element to define a description list
Use the HTML <dt> element to define the description term
Use the HTML <dd> element to describe the term in a description list
153
Tag Description
154
HTML Block and Inline Elements
Every HTML element has a default display value, depending on what type of
element it is.
Block-level Elements
A block-level element always starts on a new line and takes up the full width available
(stretches out to the left and right as far as it can).
Example
<div>Hello World</div>
<address>
<article>
155
<aside>
<blockquote>
<canvas>
<dd>
<div>
<dl>
<dt>
<fieldset>
<figcaption>
<figure>
<footer>
<form>
<h1>-<h6>
<header>
<hr>
<li>
156
<main>
<nav>
<noscript>
<ol>
<p>
<pre>
<section>
<table>
<tfoot>
<ul>
<video>
Inline Elements
An inline element does not start on a new line and only takes up as much width as
necessary.
157
Example
<span>Hello World</span>
<a>
<abbr>
<acronym>
<b>
<bdo>
<big>
<br>
<button>
<cite>
<code>
<dfn>
<em>
<i>
158
<img>
<input>
<kbd>
<label>
<map>
<object>
<output>
<q>
<samp>
<script>
<select>
<small>
<span>
<strong>
<sub>
<sup>
159
<textarea>
<time>
<tt>
<var>
When used together with CSS, the <div> element can be used to style blocks of
content:
Example
<div style="background-color:black;color:white;padding:20px;">
<h2>London</h2>
<p>London is the capital city of England. It is the most populous city in the
United Kingdom, with a metropolitan area of over 13 million inhabitants.</p>
</div>
160
The <span> Element
The <span> element is often used as a container for some text.
When used together with CSS, the <span> element can be used to style parts of the
text:
Example
<h1>My <span style="color:red">Important</span> Heading</h1>
161
HTML The class Attribute
❮ PreviousNext ❯
The HTML class attribute is used to define equal styles for elements with the same
class name.
Example
<!DOCTYPE html>
<html>
<head>
<style>
.cities {
162
background-color: black;
color: white;
margin: 20px;
padding: 20px;
}
</style>
</head>
<body>
<div class="cities">
<h2>London</h2>
<p>London is the capital of England.</p>
</div>
<div class="cities">
<h2>Paris</h2>
<p>Paris is the capital of France.</p>
</div>
<div class="cities">
<h2>Tokyo</h2>
<p>Tokyo is the capital of Japan.</p>
</div>
</body>
</html>
Result:
163
London
London is the capital of England.
Paris
Paris is the capital of France.
Tokyo
Tokyo is the capital of Japan.
Try it Yourself »
Example
<!DOCTYPE html>
<html>
<head>
164
<style>
span.note {
font-size: 120%;
color: red;
}
</style>
</head>
<body>
<h1>My <span class="note">Important</span> Heading</h1>
<p>This is some <span class="note">important</span> text.</p>
</body>
</html>
Try it Yourself »
165
Example
Use CSS to style all elements with the class name "city":
<style>
.city {
background-color: tomato;
color: white;
padding: 10px;
}
</style>
<h2 class="city">London</h2>
<p>London is the capital of England.</p>
<h2 class="city">Paris</h2>
<p>Paris is the capital of France.</p>
<h2 class="city">Tokyo</h2>
<p>Tokyo is the capital of Japan.</p>
Result:
London
London is the capital of England.
Paris
166
Paris is the capital of France.
Tokyo
Tokyo is the capital of Japan.
Try it Yourself »
Multiple Classes
HTML elements can have more than one class name, each class name must be
separated by a space.
Example
Style elements with the class name "city", also style elements with the class name
"main":
<h2 class="city main">London</h2>
<h2 class="city">Paris</h2>
<h2 class="city">Tokyo</h2>
Try it Yourself »
In the example above, the first <h2> element belongs to both the "city" class and the
"main" class.
167
Different Tags Can Share Same Class
Different tags, like <h2> and <p>, can have the same class name and thereby share the
same style:
Example
<h2 class="city">Paris</h2>
<p class="city">Paris is the capital of France</p>
Try it Yourself »
Example
When a user clicks on a button, hide all elements with the class name "city":
168
<script>
function myFunction() {
var x = document.getElementsByClassName("city");
for (var i = 0; i < x.length; i++) {
x[i].style.display = "none";
}
}
</script>
Don't worry if you don't understand the code in the example above.
You will learn more about JavaScript in our HTML JavaScript chapter, or you can study
our JavaScript Tutorial.
HTML The id Attribute
The HTML id attribute is used to specify a unique id for an HTML element (the
value must be unique within the HTML document).
169
In CSS, to select an element with a specific id, write a hash (#) character, followed by
the id of the element:
Example
Use CSS to style an element with the id "myHeader":
<style>
#myHeader {
background-color: lightblue;
color: black;
padding: 40px;
text-align: center;
}
</style>
<h1 id="myHeader">My Header</h1>
Result:
My Header
Tip: The id attribute can be used on any HTML element.
170
Difference Between Class and ID
An HTML element can only have one unique id that belongs to that single element,
while a class name can be used by multiple elements:
Example
<style>
/* Style the element with the id "myHeader" */
#myHeader {
background-color: lightblue;
color: black;
padding: 40px;
text-align: center;
}
171
<p>London is the capital of England.</p>
<h2 class="city">Paris</h2>
<p>Paris is the capital of France.</p>
<h2 class="city">Tokyo</h2>
<p>Tokyo is the capital of Japan.</p>
To make a bookmark, you must first create the bookmark, and then add a link to it.
When the link is clicked, the page will scroll to the location with the bookmark.
Example
First, create a bookmark with the id attribute:
<h2 id="C4">Chapter 4</h2>
Then, add a link to the bookmark ("Jump to Chapter 4"), from within the same page:
172
Or, add a link to the bookmark ("Jump to Chapter 4"), from another page:
Example
<a href="html_demo.html#C4">Jump to Chapter 4</a>
Example
Use the id attribute to manipulate text with JavaScript:
<script>
function displayResult() {
document.getElementById("myHeader").innerHTML = "Have a nice day!";
}
</script>
HTML Iframes
173
An HTML iframe is used to display a web page within a web page.
Iframe Syntax
An HTML iframe is defined with the <iframe> tag:
<iframe src="URL"></iframe>
The src attribute specifies the URL (web address) of the inline frame page.
Example
<iframe src="demo_iframe.htm" height="200" width="300"></iframe>
Or you can use CSS to set the height and width of the iframe:
174
Example
<iframe src="demo_iframe.htm" style="height:200px;width:300px;"></iframe>
Example
<iframe src="demo_iframe.htm" style="border:none;"></iframe>
With CSS, you can also change the size, style and color of the iframe's border:
Example
<iframe src="demo_iframe.htm" style="border:2px solid red;"></iframe>
175
An iframe can be used as the target frame for a link.
Example
<iframe src="demo_iframe.htm" name="iframe_a"></iframe>
<p><a href="https://www.w3schools.com" target="iframe_a">W3Schools.com</a></p>
HTML JavaScript
JavaScript makes HTML pages more dynamic and interactive.
176
Example
My First JavaScript
Click me to display Date and Time
Common uses for JavaScript are image manipulation, form validation, and dynamic
changes of content.
This JavaScript example writes "Hello JavaScript!" into an HTML element with
id="demo":
Example
177
<script>
document.getElementById("demo").innerHTML = "Hello JavaScript!";
</script>
A Taste of JavaScript
Here are some examples of what JavaScript can do:
178
Example
<script>
document.getElementById("demo").innerHTML = "Hello JavaScript!";
</script>
<noscript> Defines an alternate content for users that do not support client-side
scripts
179
HTML File Paths
A file path describes the location of a file in a web site's folder structure.
180
from the current folder
Web pages
Images
Style sheets
JavaScripts
Example
<img src="https://www.w3schools.com/images/picture.jpg" alt="Mountain">
181
Relative File Paths
A relative file path points to a file relative to the current page.
In this example, the file path points to a file in the images folder located at the root of
the current web:
Example
<img src="/images/picture.jpg" alt="Mountain">
In this example, the file path points to a file in the images folder located in the current
folder:
Example
<img src="images/picture.jpg" alt="Mountain">
In this example, the file path points to a file in the images folder located in the folder
one level above the current folder:
Example
<img src="../images/picture.jpg" alt="Mountain">
182
Best Practice
It is best practice to use relative file paths (if possible).
When using relative file paths, your web pages will not be bound to your current base
URL. All links will work on your own computer (localhost) as well as on your current
public domain and your future public domains.
HTML metadata is data about the HTML document. Metadata is not displayed.
Metadata typically define the document title, character set, styles, scripts, and other
meta information.
183
The HTML <title> Element
The <title> element defines the title of the document, and is required in all HTML
documents.
The <title> element:
Example
<!DOCTYPE html>
<html>
<head>
<title>Page Title</title>
</head>
<body>
The content of the document......
</body>
</html>
184
The HTML <style> Element
The <style> element is used to define style information for a single HTML page:
Example
<style>
body {background-color: powderblue;}
h1 {color: red;}
p {color: blue;}
</style>
Example
<link rel="stylesheet" href="mystyle.css">
<meta charset="UTF-8">
<meta name="author" content="John Doe">
<meta http-equiv="refresh" content="30">
Example of <meta> tags:
Example
<meta charset="UTF-8">
<meta name="description" content="Free Web tutorials">
186
<meta name="keywords" content="HTML,CSS,XML,JavaScript">
<meta name="author" content="John Doe">
The viewport is the user's visible area of a web page. It varies with the device, and
will be smaller on a mobile phone than on a computer screen.
You should include the following <meta> viewport element in all your web pages:
<meta name="viewport" content="width=device-width, initial-scale=1.0">
A <meta> viewport element gives the browser instructions on how to control the page's
dimensions and scaling.
The width=device-width part sets the width of the page to follow the screen-width of
the device (which will vary depending on the device).
The initial-scale=1.0 part sets the initial zoom level when the page is first loaded by
the browser.
Here is an example of a web page without the viewport meta tag, and the same web
page with the viewport <meta> tag:
Tip: If you are browsing this page with a phone or a tablet, you can click on the two
links below to see the difference.
187
Without the viewport meta tag
188
With the viewport meta tag
This JavaScript writes "Hello JavaScript!" into an HTML element with id="demo":
189
Example
<script>
function myFunction() {
document.getElementById("demo").innerHTML = "Hello JavaScript!";
}
</script>
Example
<base href="https://www.w3schools.com/images/" target="_blank">
190
<head> Defines information about the document
<base> Defines a default address or a default target for all links on a page
191
HTML Layout Elements and
Techniques
Websites often display content in multiple columns (like a magazine or
newspaper).
Example
Cities
London
Paris
Tokyo
London
London is the capital city of England. It is the most populous city in the United Kingdom, with a
metropolitan area of over 13 million inhabitants.
Standing on the River Thames, London has been a major settlement for two millennia, its history
going back to its founding by the Romans, who named it Londinium.
Footer
192
HTML Layout Elements
HTML offers several semantic elements that define the different parts of a web page:
CSS framework
CSS float property
193
CSS flexbox
CSS grid
CSS Frameworks
If you want to create your layout fast, you can use a framework,
like W3.CSS or Bootstrap.
Example
Cities
London
Paris
Tokyo
194
London
London is the capital city of England. It is the most populous city in the United Kingdom, with a
metropolitan area of over 13 million inhabitants.
Standing on the River Thames, London has been a major settlement for two millennia, its history
going back to its founding by the Romans, who named it Londinium.
Footer
Use of flexbox ensures that elements behave predictably when the page layout must
accommodate different screen sizes and different display devices.
Example
Cities
London
Paris
Tokyo
195
London
London is the capital city of England. It is the most populous city in the United Kingdom, with a
metropolitan area of over 13 million inhabitants.
Standing on the River Thames, London has been a major settlement for two millennia, its history
going back to its founding by the Romans, who named it Londinium.
Footer
196
A responsive web design will automatically adjust for different screen sizes and
viewports.
197
Setting The Viewport
To create a responsive website, add the following <meta> tag to all your web pages:
Example
<meta name="viewport" content="width=device-width, initial-scale=1.0">
This will set the viewport of your page, which will give the browser instructions on how
to control the page's dimensions and scaling.
Here is an example of a web page without the viewport meta tag, and the same web
page with the viewport meta tag:
198
Without the viewport meta tag:
199
With the viewport meta tag:
Tip: If you are browsing this page on a phone or a tablet, you can click on the two
links above to see the difference.
Responsive Images
Responsive images are images that scale nicely to fit any browser size.
200
Using the width Property
If the CSS width property is set to 100%, the image will be responsive and scale up
and down:
201
202
Example
<img src="img_girl.jpg" style="width:100%;">
Notice that in the example above, the image can be scaled up to be larger than its
original size. A better solution, in many cases, will be to use the max-width property
instead.
203
204
Example
<img src="img_girl.jpg" style="max-width:100%;height:auto;">
Resize the browser window to see how the image below change depending on the
width:
Example
<picture>
<source srcset="img_smallflower.jpg" media="(max-width: 600px)">
<source srcset="img_flowers.jpg" media="(max-width: 1500px)">
205
<source srcset="flowers.jpg">
<img src="img_smallflower.jpg" alt="Flowers">
</picture>
That way the text size will follow the size of the browser window:
Hello World
Resize the browser window to see how the text size scales.
Example
<h1 style="font-size:10vw">Hello World</h1>
Viewport is the browser window size. 1vw = 1% of viewport width. If the viewport is
50cm wide, 1vw is 0.5cm.
Media Queries
206
In addition to resize text and images, it is also common to use media queries in
responsive web pages.
With media queries you can define completely different styles for different browser
sizes.
Example: resize the browser window to see that the three div elements below will
display horizontally on large screens and stacked vertically on small screens:
Left Menu
Main Content
Right Content
Example
<style>
.left, .right {
float: left;
width: 20%; /* The width is 20%, by default */
}
.main {
float: left;
207
width: 60%; /* The width is 60%, by default */
}
Tip: To learn more about Media Queries and Responsive Web Design, read our RWD
Tutorial.
208
They are free, and easy to use.
Using W3.CSS
A great way to create a responsive design, is to use a responsive style sheet,
like W3.CSS
W3.CSS makes it easy to develop sites that look nice at any size; desktop, laptop,
tablet, or phone:
W3.CSS Demo
Resize the page to see the responsiveness!
London
London is the capital city of England.
It is the most populous city in the United Kingdom, with a metropolitan area of over
13 million inhabitants.
Paris
Paris is the capital of France.
The Paris area is one of the largest population centers in Europe, with more than 12
million inhabitants.
209
Tokyo
Tokyo is the capital of Japan.
It is the center of the Greater Tokyo Area, and the most populous metropolitan area in
the world.
Example
<!DOCTYPE html>
<html>
<meta name="viewport" content="width=device-width, initial-scale=1">
<link rel="stylesheet" href="https://www.w3schools.com/w3css/4/w3.css">
<body>
<div class="w3-container w3-green">
<h1>W3Schools Demo</h1>
<p>Resize this responsive page!</p>
</div>
<div class="w3-row-padding">
<div class="w3-third">
<h2>London</h2>
<p>London is the capital city of England.</p>
<p>It is the most populous city in the United Kingdom,
with a metropolitan area of over 13 million inhabitants.</p>
</div>
<div class="w3-third">
210
<h2>Paris</h2>
<p>Paris is the capital of France.</p>
<p>The Paris area is one of the largest population centers in Europe,
with more than 12 million inhabitants.</p>
</div>
<div class="w3-third">
<h2>Tokyo</h2>
<p>Tokyo is the capital of Japan.</p>
<p>It is the center of the Greater Tokyo Area,
and the most populous metropolitan area in the world.</p>
</div>
</div>
</body>
</html>
Bootstrap
Another popular framework is Bootstrap, it uses HTML, CSS and jQuery to make
responsive web pages.
Example
211
<!DOCTYPE html>
<html lang="en">
<head>
<title>Bootstrap Example</title>
<meta charset="utf-8">
<meta name="viewport" content="width=device-width, initial-scale=1">
<link rel="stylesheet" href="https://maxcdn.bootstrapcdn.com/bootstrap/3.3.7/
css/bootstrap.min.css">
<script src="https://ajax.googleapis.com/ajax/libs/jquery/3.2.0/jquery.min.js">
</script>
<script src="https://maxcdn.bootstrapcdn.com/bootstrap/3.3.7/js/bootstrap.min.j
s"></script>
</head>
<body>
<div class="container">
<div class="jumbotron">
<h1>My First Bootstrap Page</h1>
</div>
<div class="row">
<div class="col-sm-4">
...
</div>
<div class="col-sm-4">
...
</div>
<div class="col-sm-4">
...
</div>
</div>
212
</div>
</body>
</html>
Example
<code>
x = 5;<br>
y = 6;<br>
z = x + y;
</code>
213
Text surrounded by <kbd> tags is typically displayed in a monospace font:
Example
<p>Save the document by pressing <kbd>Ctrl + S</kbd></p>
Result:
Example
<p>If you input wrong value, the program will return <samp>Error!</samp></p>
Result:
Example
<code>
x = 5;
y = 6;
z = x + y;
</code>
Result:
x = 5; y = 6; z = x + y;
Notice that the <code> element does not preserve extra whitespace and line-breaks.
Example
<pre>
<code>
x = 5;
y = 6;
z = x + y;
</code>
</pre>
215
Result:
x = 5;
y = 6;
z = x + y;
Example
Einstein wrote: <var>E</var> = <var>mc</var><sup>2</sup>.
Result:
Einstein wrote: E = mc2.
216
<code> Defines programming code
HTML Semantic Elements
217
Semantic elements = elements with a meaning.
In HTML there are some semantic elements that can be used to define different parts
of a web page:
<article>
<aside>
<details>
<figcaption>
<figure>
218
<footer>
<header>
<main>
<mark>
<nav>
<section>
<summary>
<time>
Example
<section>
<h1>WWF</h1>
<p>The World Wide Fund for Nature (WWF) is....</p>
</section>
An article should make sense on its own, and it should be possible to read it
independently from the rest of the web site.
Forum post
Blog post
Newspaper article
Example
<article>
<h1>What Does WWF Do?</h1>
<p>WWF's mission is to stop the degradation of our planet's natural
environment,
220
and build a future in which humans live in harmony with nature.</p>
</article>
Can we use the definitions to decide how to nest those elements? No, we cannot!
221
The <header> element should be used as a container for introductory content.
Example
<article>
<header>
<h1>What Does WWF Do?</h1>
<p>WWF's mission:</p>
</header>
<p>WWF's mission is to stop the degradation of our planet's natural
environment,
and build a future in which humans live in harmony with nature.</p>
</article>
A footer typically contains the author of the document, copyright information, links to
terms of use, contact information, etc.
222
Example
<footer>
<p>Posted by: Hege Refsnes</p>
<p>Contact information: <a href="mailto:[email protected]">
[email protected]</a>.</p>
</footer>
Example
<nav>
<a href="/html/">HTML</a> |
<a href="/css/">CSS</a> |
<a href="/js/">JavaScript</a> |
<a href="/jquery/">jQuery</a>
</nav>
Example
<p>My family and I visited The Epcot center this summer.</p>
<aside>
<h4>Epcot Center</h4>
<p>The Epcot Center is a theme park in Disney World, Florida.</p>
</aside>
Example
<figure>
<img src="pic_trulli.jpg" alt="Trulli">
<figcaption>Fig1. - Trulli, Puglia, Italy.</figcaption>
</figure>
224
The <img> element defines the image, the <figcaption> element defines the caption.
Tag Description
225
<details> Defines additional details that the user can view or hide
<figure> Specifies self-contained content, like illustrations, diagrams, photos, code listings, etc.
226
<section> Defines a section in a document
227
Use Correct Document Type
Always declare the document type as the first line in your document.
<!DOCTYPE html>
Good:
<body>
<p>This is a paragraph</p>
</body>
228
Bad:
<BODY>
<P>This is a paragraph</P>
</BODY>
Good:
<section>
<p>This is a paragraph.</p>
<p>This is a paragraph.</p>
</section>
Bad:
<section>
<p>This is a paragraph.
<p>This is a paragraph.
</section>
229
Use Lowercase Attribute Names
HTML allows mixing uppercase and lowercase letters in attribute names.
Good:
<a href="https://www.w3schools.com/html/">Visit our HTML tutorial</a>
Bad:
<a HREF="https://www.w3schools.com/html/">Visit our HTML tutorial</a>
230
Good:
<table class="striped">
Bad:
<table class=striped>
Very bad:
This will not work, because the value contains spaces:
<table class=table striped>
Also, always define the width and height of images. This reduces flickering, because
the browser can reserve space for the image before loading.
Good:
<img src="html5.gif" alt="HTML5" style="width:128px;height:128px">
Bad:
<img src="html5.gif">
231
Spaces and Equal Signs
HTML allows spaces around equal signs. But space-less is easier to read and groups
entities better together.
Good:
<link rel="stylesheet" href="styles.css">
Bad:
<link rel = "stylesheet" href = "styles.css">
232
Do not add blank lines, spaces, or indentations without a reason.
For readability, add blank lines to separate large or logical code blocks.
For readability, add two spaces of indentation. Do not use the tab key.
Good:
<body>
<h1>Famous Cities</h1>
<h2>Tokyo</h2>
<p>Tokyo is the capital of Japan, the center of the Greater Tokyo Area,
and the most populous metropolitan area in the world.
It is the seat of the Japanese government and the Imperial Palace,
and the home of the Japanese Imperial Family.</p>
</body>
Bad:
<body>
<h1>Famous Cities</h1>
<h2>Tokyo</h2>
<p>
Tokyo is the capital of Japan, the center of the Greater Tokyo Area,
and the most populous metropolitan area in the world.
It is the seat of the Japanese government and the Imperial Palace,
and the home of the Japanese Imperial Family.
</p>
233
</body>
234
The <title> element is required in HTML.
The contents of a page title is very important for search engine optimization (SEO)!
The page title is used by search engine algorithms to decide the order when listing
pages in search results.
The <title> element:
Example
<!DOCTYPE html>
<head>
<title>Page Title</title>
</head>
<h1>This is a heading</h1>
<p>This is a paragraph.</p>
235
However, we recommend to always add the <html> and <body> tags!
The <html> element is the document root, and the recommended place for specifying
the page language. Declaring the page language is important for accessibility
applications (screen readers) and search engines.
Example
<!DOCTYPE html>
<html lang="en-us">
<head>
<title>Page Title</title>
</head>
<body>
<h1>This is a heading</h1>
<p>This is a paragraph.</p>
</body>
</html>
Omitting <head>?
The HTML <head> tag can also be omitted.
236
Browsers will add all elements before <body>, to a default <head> element.
Example
<!DOCTYPE html>
<html>
<title>Page Title</title>
<body>
<h1>This is a heading</h1>
<p>This is a paragraph.</p>
</body>
</html>
Allowed:
<meta charset="utf-8">
Also Allowed:
<meta charset="utf-8" />
237
If you expect XML/XHTML software to access your page, keep the closing slash (/),
because it is required in XML and XHTML.
Meta Data
To ensure proper interpretation and correct search engine indexing, both the language
and the character encoding should be defined as early as possible in an HTML
document:
<!DOCTYPE html>
<html lang="en-us">
<head>
<meta charset="UTF-8">
<title>Page Title</title>
</head>
<meta name="viewport" content="width=device-width, initial-scale=1.0">
238
This gives the browser instructions on how to control the page's dimensions and
scaling.
The width=device-width part sets the width of the page to follow the screen-width of
the device (which will vary depending on the device).
The initial-scale=1.0 part sets the initial zoom level when the page is first loaded by
the browser.
Here is an example of a web page without the viewport meta tag, and the same web
page with the viewport meta tag:
Tip: If you are browsing this page with a phone or a tablet, you can click on the two
links below to see the difference.
239
Without the viewport meta tag
240
With the viewport meta tag
HTML Comments
Short comments should be written on one line, like this:
241
Comments that spans more than one line, should be written like this:
<!--
This is a long comment example. This is a long comment example.
This is a long comment example. This is a long comment example.
-->
Long comments are easier to observe if they are indented with two spaces.
<link rel="stylesheet" href="styles.css">
p.intro {font-family:Verdana;font-size:16em;}
body {
background-color: lightgrey;
font-family: "Arial Black", Helvetica, sans-serif;
font-size: 16em;
color: black;
}
242
Use two spaces of indentation
Use semicolon after each property-value pair, including the last
Only use quotes around values if the value contains spaces
Place the closing bracket on a new line, without leading spaces
<script src="myscript.js">
Example
getElementById("Demo").innerHTML = "Hello";
getElementById("demo").innerHTML = "Hello";
243
Use Lower Case File Names
Some web servers (Apache, Unix) are case sensitive about file names: "london.jpg"
cannot be accessed as "London.jpg".
Other web servers (Microsoft, IIS) are not case sensitive: "london.jpg" can be
accessed as "London.jpg".
If you use a mix of uppercase and lowercase, you have to be aware of this.
If you move from a case-insensitive to a case-sensitive server, even small errors will
break your web!
File Extensions
HTML files should have a .html or .htm extension.
Both will be treated as HTML by any web browser and web server.
Default Filenames
When a URL does not specify a filename at the end (like
"https://www.w3schools.com/"), the server just adds a default filename, such as
"index.html", "index.htm", "default.html", or "default.htm".
If your server is configured only with "index.html" as the default filename, your file
must be named "index.html", and not "default.html."
However, servers can be configured with more than one default filename, and
normally you can set up as many default filenames as needed.
HTML Entities
Reserved characters in HTML must be replaced with character entities.
245
HTML Entities
Some characters are reserved in HTML.
If you use the less than (<) or greater than (>) signs in your text, the browser might
mix them with tags.
&entity_name;
OR
&#entity_number;
Non-breaking Space
A common character entity used in HTML is the non-breaking space:
A non-breaking space is a space that will not break into a new line.
246
Two words separated by a non-breaking space will stick together (not break into a
new line). This is handy when breaking the words might be disruptive.
Examples:
§ 10
10 km/h
10 PM
If you write 10 spaces in your text, the browser will remove 9 of them. To add real
spaces to your text, you can use the character entity.
The non-breaking hyphen (‑) lets you use a hyphen character (-) that won't
break.
247
non-breaking space  
248
¥ yen ¥ ¥
Some diacritical marks, like grave ( ̀) and acute ( ́) are called accents.
Diacritical marks can appear both above and below a letter, inside a letter, and
between two letters.
249
Here are some examples:
̀ a à à
́ a á á
̂ a â â
̃ a ã ã
̀ O Ò Ò
́ O Ó Ó
̂ O Ô Ô
250
̃ O Õ Õ
You will see more HTML symbols in the next chapter of this tutorial.
HTML Symbols
Characters that are not present on your keyboard can also be replaced by entities.
Many mathematical, technical, and currency symbols, are not present on a normal
keyboard.
To add such symbols to an HTML page, you can use an HTML entity name.
251
If no entity name exists, you can use an entity number, a decimal, or hexadecimal
reference.
Example
<p>I will display €</p>
<p>I will display €</p>
<p>I will display €</p>
Try it Yourself »
252
∂ ∂ ∂ PARTIAL DIFFERENTIAL
253
∏ ∏ ∏ N-ARY PRODUCT
254
Γ Γ Γ GREEK CAPITAL LETTER GAMMA
255
® ® ® REGISTERED SIGN
256
♣ ♣ ♣ BLACK CLUB SUIT
257
UTF-8 covers almost all of the characters and symbols in the world.
<meta charset="UTF-8">
UTF-8 Characters
Many UTF-8 characters cannot be typed on a keyboard, but they can always be
displayed using numbers (called entity numbers):
A is 65
B is 66
C is 67
Example
<!DOCTYPE html>
<html>
258
<head>
<meta charset="UTF-8">
</head>
<body>
</body>
</html>
Example Explained
The <meta charset="UTF-8"> element defines the character set.
The characters A, B, and C, are displayed by the numbers 65, 66, and 67.
To let the browser understand that you are displaying a character, you must start the
entity number with &# and end it with ; (semicolon).
Emoji Characters
Emojis are also characters from the UTF-8 alphabet:
😄 is 128516
😍 is 128525
💗 is 128151
259
Example
<!DOCTYPE html>
<html>
<head>
<meta charset="UTF-8">
</head>
<body>
<p>😀</p>
</body>
</html>
Since Emojis are characters, they can be copied, displayed, and sized just like any
other character in HTML.
Example
<!DOCTYPE html>
<html>
<head>
<meta charset="UTF-8">
</head>
<body>
<h1>Sized Emojis</h1>
<p style="font-size:48px">
😀 😄 😍 💗
</p>
260
</body>
</html>
Emoji Value
🗻 #128507;
🗼 #128508;
🗽 #128509;
🗾 #128510;
🗿 #128511;
261
😀 #128512;
😁 #128513;
😂 #128514;
😃 #128515;
😄 #128516;
😅 #128517;
262
You can use the CSS @charset rule to specify the character encoding used in a style
sheet:
Example
Set the encoding of the style sheet to Unicode UTF-8:
@charset "UTF-8";
ISO-8859-1 was the default character set for HTML 4. This character set supported
256 different character codes.
263
ANSI (Windows-1252) was the original Windows character set. ANSI is identical to
ISO-8859-1, except that ANSI has 32 extra characters.
Because ANSI and ISO-8859-1 were so limited, HTML 4 also supported UTF-8.
UTF-8 (Unicode) covers almost all of the characters and symbols in the world.
<meta charset="UTF-8">
264
The following table displays the differences between the character sets described
above:
32 space
33 ! ! ! ! exclamation mark
35 # # # # number sign
36 $ $ $ $ dollar sign
37 % % % % percent sign
265
38 & & & & ampersand
40 ( ( ( ( left parenthesis
41 ) ) ) ) right parenthesis
42 * * * * asterisk
43 + + + + plus sign
44 , , , , comma
45 - - - - hyphen-minus
266
46 . . . . full stop
47 / / / / solidus
48 0 0 0 0 digit zero
49 1 1 1 1 digit one
50 2 2 2 2 digit two
51 3 3 3 3 digit three
52 4 4 4 4 digit four
53 5 5 5 5 digit five
267
54 6 6 6 6 digit six
55 7 7 7 7 digit seven
56 8 8 8 8 digit eight
57 9 9 9 9 digit nine
58 : : : : colon
59 ; ; ; ; semicolon
61 = = = = equals sign
268
62 > > > > greater-than sign
63 ? ? ? ? question mark
64 @ @ @ @ commercial at
269
70 F F F F Latin capital letter F
270
78 N N N N Latin capital letter N
271
86 V V V V Latin capital letter V
92 \ \ \ \ reverse solidus
272
94 ^ ^ ^ ^ circumflex accent
95 _ _ _ _ low line
96 ` ` ` ` grave accent
273
102 f f f f Latin small letter f
274
110 n n n n Latin small letter n
275
118 v v v v Latin small letter v
276
126 ~ ~ ~ ~ tilde
127 DEL
277
134 † dagger
278
142 Ž Latin capital letter Z with caron
149 • bullet
279
150 – en dash
151 — em dash
280
158 ž Latin small letter z with caron
281
166 ¦ ¦ ¦ broken bar
168 ¨ ¨ ¨ diaeresis
282
174 ® ® ® registered sign
175 ¯ ¯ ¯ macron
283
182 ¶ ¶ ¶ pilcrow sign
184 ¸ ¸ ¸ cedilla
284
190 ¾ ¾ ¾ vulgar fraction three quarters
285
198 Æ Æ Æ Latin capital letter AE
286
206 Î Î Î Latin capital letter I with circumflex
287
214 Ö Ö Ö Latin capital letter O with diaeresis
288
222 Þ Þ Þ Latin capital letter Thorn
289
230 æ æ æ Latin small letter ae
290
238 î î î Latin small letter i with circumflex
291
246 ö ö ö Latin small letter o with diaeresis
292
254 þ þ þ Latin small letter thorn
ASCII uses the values from 32 to 126 for letters, digits, and symbols.
ANSI has a proprietary set of characters for the values from 128 to 159.
293
The ISO-8859-1 Character Set
8859-1 is identical to ASCII for the values from 0 to 127.
UTF-8 is identical to both ANSI and 8859-1 for the values from 160 to 255.
UTF-8 continues from the value 256 with more than 10 000 different characters.
Example
Set the encoding of the style sheet to Unicode UTF-8:
@charset "UTF-8";
Most people enter the name when surfing, because names are easier to remember
than numbers.
295
A Uniform Resource Locator (URL) is used to address a document (or other data) on
the web.
scheme://prefix.domain:port/path/filename
Explanation:
296
encrypted
URL Encoding
URLs can only be sent over the Internet using the ASCII character-set. If a URL
contains characters outside the ASCII set, the URL has to be converted.
URL encoding converts non-ASCII characters into a format that can be transmitted
over the Internet.
297
URLs cannot contain spaces. URL encoding normally replaces a space with a plus (+)
sign, or %20.
Try It Yourself
Hello Günter Submit
If you click "Submit", the browser will URL encode the input before it is sent to the
server.
298
€ %80 %E2%82%AC
£ %A3 %C2%A3
© %A9 %C2%A9
® %AE %C2%AE
À %C0 %C3%80
Á %C1 %C3%81
 %C2 %C3%82
299
à %C3 %C3%83
Ä %C4 %C3%84
Å %C5 %C3%85
HTML Versus XHTML
XHTML is a stricter, more XML-based version of HTML.
What is XHTML?
XHTML stands for EXtensible HyperText Markup Language
XHTML is a stricter, more XML-based version of HTML
XHTML is HTML defined as an XML application
XHTML is supported by all major browsers
300
Why XHTML?
XML is a markup language where all documents must be marked up correctly (be
"well-formed").
XHTML was developed to make HTML more extensible and flexible to work with other
data formats (such as XML). In addition, browsers ignore errors in HTML pages, and
try to display the website even if it has some errors in the markup. So XHTML comes
with a much stricter error handling
301
XHTML - <!DOCTYPE ....> Is Mandatory
An XHTML document must have an XHTML <!DOCTYPE> declaration.
The <html>, <head>, <title>, and <body> elements must also be present, and the
xmlns attribute in <html> must specify the xml namespace for the document.
Example
Here is an XHTML document with a minimum of required tags:
</body>
</html>
Correct:
<b><i>Some text</i></b>
Wrong:
<b><i>Some text</b></i>
Correct:
<p>This is a paragraph</p>
<p>This is another paragraph</p>
Wrong:
<p>This is a paragraph
<p>This is another paragraph
Correct:
A break: <br />
A horizontal rule: <hr />
An image: <img src="happy.gif" alt="Happy face" />
Wrong:
A break: <br>
A horizontal rule: <hr>
An image: <img src="happy.gif" alt="Happy face">
Correct:
<body>
<p>This is a paragraph</p>
</body>
Wrong:
<BODY>
<P>This is a paragraph</P>
</BODY>
304
XHTML Attribute Names Must be in Lowercase
In XHTML, attribute names must always be in lowercase, like this:
Correct:
<a href="https://www.w3schools.com/html/">Visit our HTML tutorial</a>
Wrong:
<a HREF="https://www.w3schools.com/html/">Visit our HTML tutorial</a>
Correct:
<a href="https://www.w3schools.com/html/">Visit our HTML tutorial</a>
Wrong:
<a href=https://www.w3schools.com/html/>Visit our HTML tutorial</a>
305
XHTML Attribute Minimization is Forbidden
In XHTML, attribute minimization is forbidden:
Correct:
<input type="checkbox" name="vehicle" value="car" checked="checked" />
<input type="text" name="lastname" disabled="disabled" />
Wrong:
<input type="checkbox" name="vehicle" value="car" checked />
<input type="text" name="lastname" disabled />
HTML Forms
An HTML form is used to collect user input. The user input can then be sent to a
server for processing.
Example
First name:
John
306
Last name:
Doe
Submit
<form>
.
form elements
.
</form>
Form elements are different types of input elements, like: text fields, checkboxes,
radio buttons, submit buttons, and more.
307
Here are some examples:
Type Description
You will learn a lot more about input types later in this tutorial.
Text Fields
<input type="text"> defines a single-line input field for text input.
Example
308
A form with two text input fields:
<form>
<label for="fname">First name:</label><br>
<input type="text" id="fname" name="fname"><br>
<label for="lname">Last name:</label><br>
<input type="text" id="lname" name="lname">
</form>
First name:
Last name:
Note: The form itself is not visible. Also note that the default width of an input field is
20 characters.
309
The <label> element also help users who have difficulty clicking on very small regions
(such as radio buttons or checkboxes) - because when the user clicks the text within
the <label> element, it toggles the radio button/checkbox.
Radio Buttons
<input type="radio"> defines a radio button.
Example
A form with radio buttons:
<form>
<input type="radio" id="male" name="gender" value="male">
<label for="male">Male</label><br>
<input type="radio" id="female" name="gender" value="female">
<label for="female">Female</label><br>
<input type="radio" id="other" name="gender" value="other">
<label for="other">Other</label>
</form>
310
Male
Female
Other
The form-handler is typically a page on the server with a script for processing input
data.
Example
A form with a submit button:
<form action="/action_page.php">
<label for="fname">First name:</label><br>
<input type="text" id="fname" name="fname" value="John"><br>
<label for="lname">Last name:</label><br>
<input type="text" id="lname" name="lname" value="Doe"><br><br>
<input type="submit" value="Submit">
</form>
311
This is how the HTML code above will be displayed in a browser:
First name:
John
Last name:
Doe
Submit
Usually, the form data is sent to a page on the server when the user clicks on the
submit button.
In the example above, the form data is sent to a page on the server called
"/action_page.php". This page contains a server-side script that handles the form
data:
<form action="/action_page.php">
The default value is "_self" which means the form will be submitted in the current
window.
To make the form result open in a new browser tab, use the value "_blank".
Example
Here, the submitted result will open in a new browser tab:
<form action="/action_page.php" target="_blank">
Other legal values are "_parent", "_top", or a name representing the name of an iframe.
Example
Use the GET method when submitting the form:
<form action="/action_page.php" method="get">
313
or:
Example
Use the POST method when submitting the form:
<form action="/action_page.php" method="post">
However, when GET is used, the form data will be visible in the page's address
field:
/action_page.php?firstname=John&lastname=Doe
Notes on GET:
314
When to Use POST?
Always use POST if the form data contains sensitive or personal information. The
POST method does not display the form data in the page address field.
Notes on POST:
POST has no size limitations, and can be used to send large amounts of data.
Form submissions with POST cannot be bookmarked
If the name attribute is omitted, the data of that input field will not be sent at all.
Example
This example will not submit the value of the "First name" input field:
<form action="/action_page.php">
<label for="fname">First name:</label><br>
<input type="text" id="fname" value="John"><br><br>
<input type="submit" value="Submit">
</form>
315
Here is the list of all <form> attributes:
Attribute Description
accept-charset Specifies the charset used in the submitted form (default: the page
charset).
action Specifies an address (url) where to submit the form (default: the
submitting page).
method Specifies the HTTP method used when submitting the form
(default: GET).
316
name Specifies a name used to identify the form (for DOM usage:
document.forms.name).
novalidate Specifies that the browser should not validate the form.
target Specifies the target of the address in the action attribute (default:
_self).
HTML Form Elements
This chapter describes all the different HTML form elements.
317
Example
<input type="text" id="firstname" name="firstname">
If the type attribute is omitted, the input field gets the default type: "text".
All the different input types are covered in the next chapter: HTML Input Types.
Example
<select id="cars" name="cars">
<option value="volvo">Volvo</option>
<option value="saab">Saab</option>
<option value="fiat">Fiat</option>
<option value="audi">Audi</option>
</select>
318
To define a pre-selected option, add the selected attribute to the option:
Example
<option value="fiat" selected>Fiat</option>
Visible Values:
Use the size attribute to specify the number of visible values:
Example
<select name="cars" size="3">
<option value="volvo">Volvo</option>
<option value="saab">Saab</option>
<option value="fiat">Fiat</option>
<option value="audi">Audi</option>
</select>
Example
319
<select name="cars" size="4" multiple>
<option value="volvo">Volvo</option>
<option value="saab">Saab</option>
<option value="fiat">Fiat</option>
<option value="audi">Audi</option>
</select>
Example
<textarea name="message" rows="10" cols="30">
The cat was playing in the garden.
</textarea>
320
You can also define the size of the text area by using CSS:
Example
<textarea name="message" style="width:200px; height:600px;">
The cat was playing in the garden.
</textarea>
Example
<button type="button" onclick="alert('Hello World!')">Click Me!</button>
321
This is how the HTML code above will be displayed in a browser:
Click Me!
Example
<form action="/action_page.php">
<fieldset>
<legend>Personalia:</legend>
<label for="fname">First name:</label><br>
<input type="text" id="fname" name="fname" value="John"><br>
<label for="lname">Last name:</label><br>
<input type="text" id="lname" name="lname" value="Doe"><br><br>
<input type="submit" value="Submit">
</fieldset>
</form>
322
Personalia:First name:
John
Last name:
Doe
Submit
Users will see a drop-down list of the pre-defined options as they input data.
Example
<form action="/action_page.php">
<input list="browsers">
<datalist id="browsers">
<option value="Internet Explorer">
<option value="Firefox">
<option value="Chrome">
<option value="Opera">
<option value="Safari">
323
</datalist>
</form>
Example
Perform a calculation and show the result in an <output> element:
<form action="/action_page.php"
oninput="x.value=parseInt(a.value)+parseInt(b.value)">
0
<input type="range" id="a" name="a" value="50">
100 +
<input type="number" id="b" name="b" value="50">
=
<output name="x" for="a b"></output>
<br><br>
<input type="submit">
</form>
324
HTML Form Elements
Tag Description
325
<select> Defines a drop-down list
HTML Input Types
326
This chapter describes the different types for the HTML <input> element.
<input type="button">
<input type="checkbox">
<input type="color">
<input type="date">
<input type="datetime-local">
<input type="email">
<input type="file">
<input type="hidden">
<input type="image">
<input type="month">
<input type="number">
<input type="password">
<input type="radio">
<input type="range">
<input type="reset">
<input type="search">
<input type="submit">
<input type="tel">
<input type="text">
<input type="time">
<input type="url">
<input type="week">
327
Input Type Text
<input type="text"> defines a single-line text input field:
Example
<form>
<label for="fname">First name:</label><br>
<input type="text" id="fname" name="fname"><br>
<label for="lname">Last name:</label><br>
<input type="text" id="lname" name="lname">
</form>
First name:
Last name:
Example
328
<form>
<label for="username">Username:</label><br>
<input type="text" id="username" name="username"><br>
<label for="pwd">Password:</label><br>
<input type="password" id="pwd" name="pwd">
</form>
Username:
Password:
The form-handler is typically a server page with a script for processing input data.
Example
<form action="/action_page.php">
<label for="fname">First name:</label><br>
329
<input type="text" id="fname" name="fname" value="John"><br>
<label for="lname">Last name:</label><br>
<input type="text" id="lname" name="lname" value="Doe"><br><br>
<input type="submit" value="Submit">
</form>
First name:
John
Last name:
Doe
Submit
If you omit the submit button's value attribute, the button will get a default text:
Example
<form action="/action_page.php">
<label for="fname">First name:</label><br>
<input type="text" id="fname" name="fname" value="John"><br>
<label for="lname">Last name:</label><br>
<input type="text" id="lname" name="lname" value="Doe"><br><br>
<input type="submit">
</form>
Example
<form action="/action_page.php">
<label for="fname">First name:</label><br>
<input type="text" id="fname" name="fname" value="John"><br>
<label for="lname">Last name:</label><br>
<input type="text" id="lname" name="lname" value="Doe"><br><br>
<input type="submit" value="Submit">
<input type="reset">
</form>
First name:
John
Last name:
Doe
Submit Reset
If you change the input values and then click the "Reset" button, the form-data will be
reset to the default values.
331
Radio buttons let a user select ONLY ONE of a limited number of choices:
Example
<form>
<input type="radio" id="male" name="gender" value="male">
<label for="male">Male</label><br>
<input type="radio" id="female" name="gender" value="female">
<label for="female">Female</label><br>
<input type="radio" id="other" name="gender" value="other">
<label for="other">Other</label>
</form>
Male
Female
Other
Checkboxes let a user select ZERO or MORE options of a limited number of choices.
332
Example
<form>
<input type="checkbox" id="vehicle1" name="vehicle1" value="Bike">
<label for="vehicle1"> I have a bike</label><br>
<input type="checkbox" id="vehicle2" name="vehicle2" value="Car">
<label for="vehicle2"> I have a car</label><br>
<input type="checkbox" id="vehicle3" name="vehicle3" value="Boat">
<label for="vehicle3"> I have a boat</label>
</form>
I have a bike
I have a car
I have a boat
Example
<input type="button" onclick="alert('Hello World!')" value="Click Me!">
333
Input Type Color
The <input type="color"> is used for input fields that should contain a color.
Depending on browser support, a color picker can show up in the input field.
Example
<form>
<label for="favcolor">Select your favorite color:</label>
<input type="color" id="favcolor" name="favcolor">
</form>
Depending on browser support, a date picker can show up in the input field.
Example
<form>
<label for="birthday">Birthday:</label>
<input type="date" id="birthday" name="birthday">
</form>
334
You can also use the min and max attributes to add restrictions to dates:
Example
<form>
<label for="datemax">Enter a date before 1980-01-01:</label>
<input type="date" id="datemax" name="datemax" max="1979-12-31"><br><br>
<label for="datemin">Enter a date after 2000-01-01:</label>
<input type="date" id="datemin" name="datemin" min="2000-01-02">
</form>
Depending on browser support, a date picker can show up in the input field.
Example
<form>
<label for="birthdaytime">Birthday (date and time):</label>
<input type="datetime-local" id="birthdaytime" name="birthdaytime">
</form>
Some smartphones recognize the email type, and add ".com" to the keyboard to
match email input.
Example
<form>
<label for="email">Enter your email:</label>
<input type="email" id="email" name="email">
</form>
Example
<form>
<label for="myfile">Select a file:</label>
<input type="file" id="myfile" name="myfile">
</form>
336
Input Type Month
The <input type="month"> allows the user to select a month and year.
Depending on browser support, a date picker can show up in the input field.
Example
<form>
<label for="bdaymonth">Birthday (month and year):</label>
<input type="month" id="bdaymonth" name="bdaymonth">
</form>
The following example displays a numeric input field, where you can enter a value
from 1 to 5:
Example
<form>
<label for="quantity">Quantity (between 1 and 5):</label>
<input type="number" id="quantity" name="quantity" min="1" max="5">
</form>
337
Input Restrictions
Here is a list of some common input restrictions:
Attribute Description
338
pattern Specifies a regular expression to check the input value against
You will learn more about input restrictions in the next chapter.
The following example displays a numeric input field, where you can enter a value
from 0 to 100, in steps of 10. The default value is 30:
Example
339
<form>
<label for="quantity">Quantity:</label>
<input type="number" id="quantity" name="quantity" min="0" max="100" step="10
" value="30">
</form>
Example
<form>
<label for="vol">Volume (between 0 and 50):</label>
<input type="range" id="vol" name="vol" min="0" max="50">
</form>
Example
340
<form>
<label for="gsearch">Search Google:</label>
<input type="search" id="gsearch" name="gsearch">
</form>
Example
<form>
<label for="phone">Enter your phone number:</label>
<input type="tel" id="phone" name="phone" pattern="[0-9]{3}-[0-9]{2}-[0-9]
{3}">
</form>
Depending on browser support, a time picker can show up in the input field.
Example
341
<form>
<label for="appt">Select a time:</label>
<input type="time" id="appt" name="appt">
</form>
Depending on browser support, the url field can be automatically validated when
submitted.
Some smartphones recognize the url type, and adds ".com" to the keyboard to match
url input.
Example
<form>
<label for="homepage">Add your homepage:</label>
<input type="url" id="homepage" name="homepage">
</form>
342
Depending on browser support, a date picker can show up in the input field.
Example
<form>
<label for="week">Select a week:</label>
<input type="week" id="week" name="week">
</form>
HTML Input Attributes
This chapter describes the different attributes for the HTML <input> element.
343
The value Attribute
The input value attribute specifies an initial value for an input field:
Example
Input fields with initial (default) values:
<form>
<label for="fname">First name:</label><br>
<input type="text" id="fname" name="fname" value="John"><br>
<label for="lname">Last name:</label><br>
<input type="text" id="lname" name="lname" value="Doe">
</form>
A read-only input field cannot be modified (however, a user can tab to it, highlight it,
and copy the text from it).
The value of a read-only input field will be sent when submitting the form!
Example
344
A read-only input field:
<form>
<label for="fname">First name:</label><br>
<input type="text" id="fname" name="fname" value="John" readonly><br>
<label for="lname">Last name:</label><br>
<input type="text" id="lname" name="lname" value="Doe">
</form>
The value of a disabled input field will not be sent when submitting the form!
Example
A disabled input field:
<form>
<label for="fname">First name:</label><br>
<input type="text" id="fname" name="fname" value="John" disabled><br>
<label for="lname">Last name:</label><br>
<input type="text" id="lname" name="lname" value="Doe">
</form>
345
The size Attribute
The input size attribute specifies the visible width, in characters, of an input field.
Note: The size attribute works with the following input types: text, search, tel, url,
email, and password.
Example
Set a width for an input field:
<form>
<label for="fname">First name:</label><br>
<input type="text" id="fname" name="fname" size="50"><br>
<label for="pin">PIN:</label><br>
<input type="text" id="pin" name="pin" size="4">
</form>
346
Note: When a maxlength is set, the input field will not accept more than the specified
number of characters. However, this attribute does not provide any feedback. So, if
you want to alert the user, you must write JavaScript code.
Example
Set a maximum length for an input field:
<form>
<label for="fname">First name:</label><br>
<input type="text" id="fname" name="fname" size="50"><br>
<label for="pin">PIN:</label><br>
<input type="text" id="pin" name="pin" maxlength="4" size="4">
</form>
The min and max attributes work with the following input types: number, range, date,
datetime-local, month, time and week.
Tip: Use the max and min attributes together to create a range of legal values.
Example
Set a max date, a min date, and a range of legal values:
347
<form>
<label for="datemax">Enter a date before 1980-01-01:</label>
<input type="date" id="datemax" name="datemax" max="1979-12-31"><br><br>
The multiple attribute works with the following input types: email, and file.
Example
A file upload field that accepts multiple values:
<form>
<label for="files">Select files:</label>
<input type="file" id="files" name="files" multiple>
</form>
348
The pattern Attribute
The input pattern attribute specifies a regular expression that the input field's value is
checked against, when the form is submitted.
The pattern attribute works with the following input types: text, date, search, url, tel,
email, and password.
Example
An input field that can contain only three letters (no numbers or special characters):
<form>
<label for="country_code">Country code:</label>
<input type="text" id="country_code" name="country_code"
pattern="[A-Za-z]{3}" title="Three letter country code">
</form>
349
The input placeholder attribute specifies short a hint that describes the expected value
of an input field (a sample value or a short description of the expected format).
The short hint is displayed in the input field before the user enters a value.
The placeholder attribute works with the following input types: text, search, url, tel,
email, and password.
Example
An input field with a placeholder text:
<form>
<label for="phone">Enter a phone number:</label>
<input type="tel" id="phone" name="phone"
placeholder="123-45-678"
pattern="[0-9]{3}-[0-9]{2}-[0-9]{3}">
</form>
The required attribute works with the following input types: text, search, url, tel,
email, password, date pickers, number, checkbox, radio, and file.
350
Example
A required input field:
<form>
<label for="username">Username:</label>
<input type="text" id="username" name="username" required>
</form>
Tip: This attribute can be used together with the max and min attributes to create a
range of legal values.
The step attribute works with the following input types: number, range, date,
datetime-local, month, time and week.
Example
An input field with a specified legal number intervals:
<form>
<label for="points">Points:</label>
351
<input type="number" id="points" name="points" step="3">
</form>
Note: Input restrictions are not foolproof, and JavaScript provides many ways to add
illegal input. To safely restrict input, it must also be checked by the receiver (the
server)!
Example
Let the "First name" input field automatically get focus when the page loads:
<form>
<label for="fname">First name:</label><br>
<input type="text" id="fname" name="fname" autofocus><br>
<label for="lname">Last name:</label><br>
<input type="text" id="lname" name="lname">
</form>
Tip: Always specify both the height and width attributes for images. If height and
width are set, the space required for the image is reserved when the page is loaded.
Without these attributes, the browser does not know the size of the image, and
cannot reserve the appropriate space to it. The effect will be that the page layout will
change during loading (while the images load).
Example
Define an image as the submit button, with height and width attributes:
<form>
<label for="fname">First name:</label>
<input type="text" id="fname" name="fname"><br><br>
<label for="lname">Last name:</label>
<input type="text" id="lname" name="lname"><br><br>
<input type="image" src="img_submit.gif" alt="Submit" width="48" height="48">
</form>
Example
353
An <input> element with pre-defined values in a <datalist>:
<form>
<input list="browsers">
<datalist id="browsers">
<option value="Internet Explorer">
<option value="Firefox">
<option value="Chrome">
<option value="Opera">
<option value="Safari">
</datalist>
</form>
Autocomplete allows the browser to predict the value. When a user starts to type in a
field, the browser should display options to fill in the field, based on earlier typed
values.
Example
An HTML form with autocomplete on, and off for one input field:
354
<form action="/action_page.php" autocomplete="on">
<label for="fname">First name:</label>
<input type="text" id="fname" name="fname"><br><br>
<label for="lname">Last name:</label>
<input type="text" id="lname" name="lname"><br><br>
<label for="email">Email:</label>
<input type="email" id="email" name="email" autocomplete="off"><br><br>
<input type="submit" value="Submit">
</form>
Tip: In some browsers you may need to activate an autocomplete function for this to
work (Look under "Preferences" in the browser's menu).
355
HTML Input form* Attributes
This chapter describes the different form* attributes for the HTML <input> element.
The value of this attribute must be equal to the id attribute of the <form> element it
belongs to.
Example
An input field located outside of the HTML form (but still a part of the form):
<form action="/action_page.php" id="form1">
<label for="fname">First name:</label>
<input type="text" id="fname" name="fname"><br><br>
<input type="submit" value="Submit">
</form>
<label for="lname">Last name:</label>
<input type="text" id="lname" name="lname" form="form1">
356
The formaction Attribute
The input formaction attribute specifies the URL of the file that will process the input
when the form is submitted.
The formaction attribute works with the following input types: submit and image.
Example
An HTML form with two submit buttons, with different actions:
<form action="/action_page.php">
<label for="fname">First name:</label>
<input type="text" id="fname" name="fname"><br><br>
<label for="lname">Last name:</label>
<input type="text" id="lname" name="lname"><br><br>
<input type="submit" value="Submit">
<input type="submit" formaction="/action_page2.php" value="Submit as Admin">
</form>
357
Note: This attribute overrides the enctype attribute of the <form> element.
The formenctype attribute works with the following input types: submit and image.
Example
A form with two submit buttons. The first sends the form-data with default encoding,
the second sends the form-data encoded as "multipart/form-data":
<form action="/action_page_binary.asp" method="post">
<label for="fname">First name:</label>
<input type="text" id="fname" name="fname"><br><br>
<input type="submit" value="Submit">
<input type="submit" formenctype="multipart/form-data"
value="Submit as Multipart/form-data">
</form>
The formmethod attribute works with the following input types: submit and image.
358
Notes on the "get" method:
Example
A form with two submit buttons. The first sends the form-data with method="get".
The second sends the form-data with method="post":
<form action="/action_page.php" method="get">
<label for="fname">First name:</label>
<input type="text" id="fname" name="fname"><br><br>
<label for="lname">Last name:</label>
<input type="text" id="lname" name="lname"><br><br>
<input type="submit" value="Submit using GET">
<input type="submit" formmethod="post" value="Submit using POST">
</form>
359
The formtarget Attribute
The input formtarget a attribute specifies a name or a keyword that indicates where to
display the response that is received after submitting the form.
The formtarget attribute works with the following input types: submit and image.
Example
A form with two submit buttons, with different target windows:
<form action="/action_page.php">
<label for="fname">First name:</label>
<input type="text" id="fname" name="fname"><br><br>
<label for="lname">Last name:</label>
<input type="text" id="lname" name="lname"><br><br>
<input type="submit" value="Submit">
<input type="submit" formtarget="_blank" value="Submit to a new window/tab">
</form>
360
The formnovalidate attribute works with the following input types: submit.
Example
A form with two submit buttons (with and without validation):
<form action="/action_page.php">
<label for="email">Enter your email:</label>
<input type="email" id="email" name="email"><br><br>
<input type="submit" value="Submit">
<input type="submit" formnovalidate="formnovalidate"
value="Submit without validation">
</form>
When present, novalidate specifies that all of the form-data should not be validated
when submitted.
Example
Specify that no form-data should be validated on submit:
<form action="/action_page.php" novalidate>
<label for="email">Enter your email:</label>
<input type="email" id="email" name="email"><br><br>
361
<input type="submit" value="Submit">
</form>
362
363