HTML Tutorial
HTML Tutorial
HTML Tutorial
</body>
</html>
Example Explained
• The text between <html> and </html> describes the web page
• The text between <body> and </body> is the visible page content
• The text between <h1> and </h1> is displayed as a heading
• The text between <p> and </p> is displayed as a paragraph
What You Need
You don't need any tools to learn HTML at W3Schools.
You don't need any HTML editor
You don't need a web server
You don't need a web site
Editing HTML
In this tutorial we use a plain text editor (like Notepad) to edit HTML. We believe this is the best
way to learn HTML.
However, professional web developers often prefer HTML editors like FrontPage or
Dreamweaver, instead of writing plain text.
Create Your Own Test Web
If you just want to learn HTML, skip the rest of this chapter.
If you want to create a test web on your own computer, just copy the 3 files below to your
desktop.
(Right click on each link, and select "save target as" or "save link as")
mainpage.htm
page1.htm
page2.htm
After you have copied the files, you can double-click on the file called "mainpage.htm" and see
your first web site in action.
Use Your Test Web For Learning
We suggest you experiment with everything you learn at W3Schools by editing your web files
with a text editor (like Notepad).
Note: If your test web contains HTML markup tags you have not learned, don't panic. You will
learn all about it in the next chapters.
HTML Links
HTML links are defined with the <a> tag.
Example
<a href="http://www.w3schools.com">This is a link</a>
HTML Images
HTML images are defined with the <img> tag.
Example
<img src="w3schools.jpg" width="104" height="142" />
Note: The name and the size of the image are provided as attributes.
(You will learn about attributes in a later chapter of this tutorial)
HTML documents are defined by HTML elements.
HTML Elements
An HTML element is everything from the start tag to the end tag:
Start tag * Element content End tag *
<br />
* The start tag is often called the opening tag. The end tag is often called the closing tag.
HTML Element Syntax
• An HTML element starts with a start tag / opening tag
• An HTML element ends with an end tag / closing tag
• The element content is everything between the start and the end tag
• Some HTML elements have empty content
• Empty elements are closed in the start tag
• Most HTML elements can have attributes
(You will learn about element attributes in the next chapter of this tutorial)
Nested HTML Elements
Most HTML elements can be nested (can contain other HTML elements).
HTML documents consist of nested HTML elements.
HTML Document Example
<html>
<body>
<p>This is my first paragraph</p>
</body>
</html>
Example Explained
The <p> element:
<p>This is my first paragraph</p>
<body>
<p>This is my first paragraph</p>
</body>
</html>
The example above will work in most browsers, but don't rely on it. Forgetting the end tag can
produce unexpected results or errors.
Note: Future version of HTML will not allow you to skip end tags.
HTML Attributes
• HTML elements can have attributes
• Attributes provide additional information about the element
• Attributes are always specified in the start tag
• Attributes come in name/value pairs like: name="value"
Attribute Example
HTML links are defined with the <a> tag. The link address is provided as an attribute:
Example
<a
href="http://www.w3schools.com">This
is a link</a>
HTML Headings
Headings are defined with the <h1> to <h6> tags.
<h1> defines the largest heading. <h6> defines the smallest
heading.
Example
<h1>This is a heading</h1>
<h2>This is a heading</h2>
<h3>This is a heading</h3>
Try it yourself »
Note: Browsers automatically add an empty line before and
after headings.
Try it yourself »
HTML Comments
Comments can be inserted in the HTML code to make it more
readable and understandable. Comments are ignored by the
browser and are not displayed.
Comments are written like this:
Example
<!-- This is a comment -->
Try it yourself »
Note: There is an exclamation point after the opening bracket,
but not before the closing bracket.
Headings
This example demonstrates the tags that display headings in an
HTML document.
Hidden comments
This example demonstrates how to insert a hidden comment in
the HTML source code.
Horizontal rule
This example demonstrates how to insert a horizontal rule.
HTML Paragraphs
Paragraphs are defined with the <p> tag.
Example
<p>This is a paragraph</p>
<p>This is another paragraph</p>
Try it yourself »
Note: Browsers automatically add an empty line before and
after paragraphs.
Try it yourself »
The <br /> element is an empty HTML element. It has no end
tag.
HTML paragraphs
This example demonstrates how HTML paragraphs are
displayed in a browser.
Line breaks
This example demonstrates the use of line breaks in an HTML
document.
Poem problems
This example demonstrates some problems with HTML
formatting.
More Examples
More paragraphs
This example demonstrates some of the default behaviors of
paragraph elements.
Try it yourself »
Text formatting
This example demonstrates how you can format text in an
HTML document.
Preformatted text
This example demonstrates how you can control the line breaks
and spaces with the pre tag.
"Computer output" tags
This example demonstrates how different "computer output"
tags will be displayed.
Address
This example demonstrates how to write an address in an HTML
document.
Abbreviations and acronyms
This example demonstrates how to handle an abbreviation or an
acronym.
Text direction
This example demonstrates how to change the text direction.
Quotations
This example demonstrates how to handle long and short
quotations.
Deleted and inserted text
This example demonstrates how to mark a text that is deleted or
inserted to a document.
Try it yourself
Style Examples:
Background Color
<body style="background-color:yellow">
The style attribute defines a style for the <body> element.
Try it yourself: Background color
The new style attribute makes the "old" bgcolor attribute
obsolete.
Try it yourself: Background the old way
Text Alignment
<h1 style="text-align:center">
The style attribute defines a style for the <h1> element.
Try it yourself: Centered heading
The new style attribute makes the old "align" attribute obsolete.
Try it yourself: Centered heading the old way
A link is the "address" to a document (or a resource) on the web.
An HTML Link
Link syntax:
<a href="url">Link text</a>
The start tag contains attributes about the link.
The element content (Link text) defines the part to be displayed.
Note: The element content doesn't have to be text. You can link
from an image or any other HTML element.
The href Attribute
The href attribute defines the link "address".
This <a> element defines a link to W3Schools:
<a href="http://www.w3schools.com/">Visit W3Schools!</a>
The code above will display like this in a browser:
Visit W3Schools!
Try it yourself »
More Examples
An image as a link
This example demonstrates how to use an image as a link.
Link to a location on the same page
This example demonstrates how to use a link to jump to another
part of a document.
Break out of a frame
This example demonstrates how to break out of a frame, if your
site is locked in a frame.
Create a mailto link
This example demonstrates how to link to a mail message (will
only work if you have mail installed).
Create a mailto link 2
This example demonstrates a more complicated mailto link.
Link Tags
Tag Description
<a> Defines an anchor
Example
Norwegian Mountain Trip
Try it yourself »
Try it Yourself - Examples
Insert images
This example demonstrates how to insert images to your Web
page.
Insert images from different locations
This example demonstrates how to insert an image from another
folder or another server.
(You can find more examples at the bottom of this page)
More Examples
Background image
This example demonstrates how to add a background image to
an HTML page.
Aligning images
This example demonstrates how to align an image within the
text.
Let the image float
This example demonstrates how to let an image float to the left
or right of a paragraph.
Adjust images to different sizes
This example demonstrates how to adjust images to different
sizes.
Display an alternate text for an image
This example demonstrates how to display an alternate text for
an image if a browser cannot display the image. You should
always include the alt attribute for images.
Make a hyperlink of an image
This example demonstrates how to use an image as a link.
Create an image map
This example demonstrates how to create an image map, with
clickable regions. Each of the regions is a hyperlink.
Image Tags
Tag Description
<img> Defines an image
<map> Defines an image map
<area> Defines a clickable area inside an image map
HTML Tables
Apples 44%
Bananas 23%
Oranges 13%
Other 10%
Tables
How to define tables in an HTML document.
Table borders
This example demonstrates different table borders.
More examples at the bottom of the page.
Tables
Tables are defined with the <table> tag. A table is divided into
rows (with the <tr> tag), and each row is divided into data cells
(with the <td> tag). The letters td stands for "table data," which
is the content of a data cell. A data cell can contain text, images,
lists, paragraphs, forms, horizontal rules, tables, etc.
<table border="1">
<tr>
<td>row 1, cell 1</td>
<td>row 1, cell 2</td>
</tr>
<tr>
<td>row 2, cell 1</td>
<td>row 2, cell 2</td>
</tr>
</table>
How it looks in a browser:
row 1, cell 1 row 1, cell 2
row 2, cell 1 row 2, cell 2
Headings in a Table
Headings in a table are defined with the <th> tag.
<table border="1">
<tr>
<th>Heading</th>
<th>Another Heading</th>
</tr>
<tr>
<td>row 1, cell 1</td>
<td>row 1, cell 2</td>
</tr>
<tr>
<td>row 2, cell 1</td>
<td>row 2, cell 2</td>
</tr>
</table>
How it looks in a browser:
Heading Another Heading
row 1, cell 1 row 1, cell 2
row 2, cell 1 row 2, cell 2
More Examples
Table Tags
Tag Description
<table> Defines a table
<th> Defines a table header
<tr> Defines a table row
<td> Defines a table cell
<caption> Defines a table caption
<colgroup>Defines groups of table columns
Defines the attribute values for one or more columns
<col>
in a table
<thead> Defines a table head
<tbody> Defines a table body
<tfoot> Defines a table footer
HTML supports ordered, unordered and definition lists.
HTML Lists
• This is the first
• This is the second
• This is the third
Try-It-Yourself Examples
Unordered list
Ordered list
(You can find more examples at the bottom of this page)
Unordered Lists
An unordered list is a list of items. The list items are marked
with bullets (typically small black circles).
An unordered list starts with the <ul> tag. Each list item starts
with the <li> tag.
<ul>
<li>Coffee</li>
<li>Milk</li>
</ul>
Here is how it looks in a browser:
• Coffee
• Milk
Inside a list item you can put paragraphs, line breaks, images,
links, other lists, etc.
Ordered Lists
An ordered list is also a list of items. The list items are marked
with numbers.
An ordered list starts with the <ol> tag. Each list item starts with
the <li> tag.
<ol>
<li>Coffee</li>
<li>Milk</li>
</ol>
Here is how it looks in a browser:
1. Coffee
2. Milk
Inside a list item you can put paragraphs, line breaks, images,
links, other lists, etc.
Definition Lists
A definition list is not a list of single items. It is a list of items
(terms), with a description of each item (term).
A definition list starts with a <dl> tag (definition list).
Each term starts with a <dt> tag (definition term).
Each description starts with a <dd> tag (definition description).
<dl>
<dt>Coffee</dt>
<dd>Black hot drink</dd>
<dt>Milk</dt>
<dd>White cold drink</dd>
</dl>
Here is how it looks in a browser:
Coffee
Black hot drink
Milk
White cold drink
Inside the <dd> tag you can put paragraphs, line breaks, images,
links, other lists, etc.
More Examples
List Tags
Tag Description
<ol> Defines an ordered list
<ul> Defines an unordered list
<li> Defines a list item
<dl> Defines a definition list
<dt> Defines a term (an item) in a definition list
<dd> Defines a description of a term in a definition list
<dir> Deprecated. Use <ul> instead
<menu> Deprecated. Use <ul> instead
HTML Forms are used to select different kinds of user input.
Try-It-Yourself Examples
Text fields
This example demonstrates how to create text fields on an
HTML page. A user can write text in a text field.
Password fields
This example demonstrates how to create a password field on an
HTML page.
(You can find more examples at the bottom of this page)
Forms
A form is an area that can contain form elements.
Form elements are elements that allow the user to enter
information (like text fields, textarea fields, drop-down menus,
radio buttons, checkboxes, etc.) in a form.
A form is defined with the <form> tag.
<form>
.
input elements
.
</form>
Input
The most used form tag is the <input> tag. The type of input is
specified with the type attribute. The most commonly used input
types are explained below.
Text Fields
Text fields are used when you want the user to type letters,
numbers, etc. in a form.
<form>
First name:
<input type="text" name="firstname" />
<br />
Last name:
<input type="text" name="lastname" />
</form>
How it looks in a browser:
Top of Form
First name:
Last name:
Bottom of Form
Note that the form itself is not visible. Also note that in most
browsers, the width of the text field is 20 characters by default.
Radio Buttons
Radio Buttons are used when you want the user to select one of
a limited number of choices.
<form>
<input type="radio" name="sex" value="male" />
Male
<br />
<input type="radio" name="sex"
value="female" /> Female
</form>
How it looks in a browser:
Top of Form
Male
Female
Bottom of Form
Note that only one option can be chosen.
Checkboxes
Checkboxes are used when you want the user to select one or
more options of a limited number of choices.
<form>
I have a bike:
<input type="checkbox" name="vehicle"
value="Bike" />
<br />
I have a car:
<input type="checkbox" name="vehicle"
value="Car" />
<br />
I have an airplane:
<input type="checkbox" name="vehicle"
value="Airplane" />
</form>
How it looks in a browser:
Top of Form
I have a bike:
I have a car:
I have an airplane:
Bottom of Form
Username:
Bottom of Form
If you type some characters in the text field above, and click the
"Submit" button, the browser will send your input to a page
called "html_form_submit.asp". The page will show you the
received input.
More Examples
Checkboxes
This example demonstrates how to create check-boxes on an
HTML page. A user can select or unselect a checkbox.
Radio buttons
This example demonstrates how to create radio-buttons on an
HTML page.
Simple drop down box
This example demonstrates how to create a simple drop-down
box on an HTML page. A drop-down box is a selectable list.
Another drop down box
This example demonstrates how to create a simple drop-down
box with a pre-selected value.
Textarea
This example demonstrates how to create a text-area (a multi-
line text input control). A user can write text in the text-area. In
a text-area you can write an unlimited number of characters.
Create a button
This example demonstrates how to create a button. On the
button you can define your own text.
Fieldset around data
This example demonstrates how to draw a border with a caption
around your data.
Form Examples
Form with input fields and a submit button
This example demonstrates how to add a form to a page. The
form contains two input fields and a submit button.
Form with checkboxes
This form contains three checkboxes, and a submit button.
Form with radio buttons
This form contains two radio buttons, and a submit button.
Send e-mail from a form
This example demonstrates how to send e-mail from a form.
Form Tags
Tag Description
<form> Defines a form for user input
<input> Defines an input field
<textare Defines a text-area (a multi-line text
a> input control)
<label> Defines a label to a control
<fieldset Defines a fieldset
>
<legend
Defines a caption for a fieldset
>
Defines a selectable list (a drop-down
<select>
box)
<optgrou
Defines an option group
p>
<option> Defines an option in the drop-down box
<button
Defines a push button
>
<isindex
Deprecated. Use <input> instead
>
Color Values
HTML colors are defined using a hexadecimal (hex) notation for
the combination of Red, Green, and Blue color values (RGB).
The lowest value that can be given to one of the light sources is
0 (hex 00). The highest value is 255 (hex FF).
Hex values are written as 3 double digit numbers, starting with a
# sign.
Color Values
Color Color HEX Color RGB
#000000 rgb(0,0,0)
#FF0000 rgb(255,0,0)
#00FF00 rgb(0,255,0)
#0000FF rgb(0,0,255)
#FFFF00 rgb(255,255,0)
#00FFFF rgb(0,255,255)
#FF00FF rgb(255,0,255)
#C0C0C0 rgb(192,192,192)
#FFFFFF rgb(255,255,255)
Try it yourself »
Sorted by Names
Link: Same list sorted by values
Color Name HEX Color Shades Mix
AliceBlue #F0F8FF Shades Mix
AntiqueWhite #FAEBD7 Shades Mix
Aqua #00FFFF Shades Mix
Aquamarine #7FFFD4 Shades Mix
Azure #F0FFFF Shades Mix
Beige #F5F5DC Shades Mix
Bisque #FFE4C4 Shades Mix
Black #000000 Shades Mix
BlanchedAlmond #FFEBCD Shades Mix
Blue #0000FF Shades Mix
BlueViolet #8A2BE2 Shades Mix
Brown #A52A2A Shades Mix
BurlyWood #DEB887 Shades Mix
CadetBlue #5F9EA0 Shades Mix
Chartreuse #7FFF00 Shades Mix
Chocolate #D2691E Shades Mix
Coral #FF7F50 Shades Mix
CornflowerBlue #6495ED Shades Mix
Cornsilk #FFF8DC Shades Mix
Crimson #DC143C Shades Mix
Cyan #00FFFF Shades Mix
DarkBlue #00008B Shades Mix
DarkCyan #008B8B Shades Mix
DarkGoldenRod #B8860B Shades Mix
DarkGray #A9A9A9 Shades Mix
DarkGreen #006400 Shades Mix
DarkKhaki #BDB76B Shades Mix
DarkMagenta #8B008B Shades Mix
DarkOliveGreen #556B2F Shades Mix
Darkorange #FF8C00 Shades Mix
DarkOrchid #9932CC Shades Mix
DarkRed #8B0000 Shades Mix
DarkSalmon #E9967A Shades Mix
DarkSeaGreen #8FBC8F Shades Mix
DarkSlateBlue #483D8B Shades Mix
DarkSlateGray #2F4F4F Shades Mix
DarkTurquoise #00CED1 Shades Mix
DarkViolet #9400D3 Shades Mix
DeepPink #FF1493 Shades Mix
DeepSkyBlue #00BFFF Shades Mix
DimGray #696969 Shades Mix
DodgerBlue #1E90FF Shades Mix
FireBrick #B22222 Shades Mix
FloralWhite #FFFAF0 Shades Mix
ForestGreen #228B22 Shades Mix
Fuchsia #FF00FF Shades Mix
Gainsboro #DCDCDC Shades Mix
GhostWhite #F8F8FF Shades Mix
Gold #FFD700 Shades Mix
GoldenRod #DAA520 Shades Mix
Gray #808080 Shades Mix
Green #008000 Shades Mix
GreenYellow #ADFF2F Shades Mix
HoneyDew #F0FFF0 Shades Mix
HotPink #FF69B4 Shades Mix
IndianRed #CD5C5C Shades Mix
Indigo #4B0082 Shades Mix
Ivory #FFFFF0 Shades Mix
Khaki #F0E68C Shades Mix
Lavender #E6E6FA Shades Mix
LavenderBlush #FFF0F5 Shades Mix
LawnGreen #7CFC00 Shades Mix
LemonChiffon #FFFACD Shades Mix
LightBlue #ADD8E6 Shades Mix
LightCoral #F08080 Shades Mix
LightCyan #E0FFFF Shades Mix
LightGoldenRodYellow #FAFAD2 Shades Mix
LightGrey #D3D3D3 Shades Mix
LightGreen #90EE90 Shades Mix
LightPink #FFB6C1 Shades Mix
LightSalmon #FFA07A Shades Mix
LightSeaGreen #20B2AA Shades Mix
LightSkyBlue #87CEFA Shades Mix
LightSlateGray #778899 Shades Mix
LightSteelBlue #B0C4DE Shades Mix
LightYellow #FFFFE0 Shades Mix
Lime #00FF00 Shades Mix
LimeGreen #32CD32 Shades Mix
Linen #FAF0E6 Shades Mix
Magenta #FF00FF Shades Mix
Maroon #800000 Shades Mix
MediumAquaMarine #66CDAA Shades Mix
MediumBlue #0000CD Shades Mix
MediumOrchid #BA55D3 Shades Mix
MediumPurple #9370D8 Shades Mix
MediumSeaGreen #3CB371 Shades Mix
MediumSlateBlue #7B68EE Shades Mix
MediumSpringGreen #00FA9A Shades Mix
MediumTurquoise #48D1CC Shades Mix
MediumVioletRed #C71585 Shades Mix
MidnightBlue #191970 Shades Mix
MintCream #F5FFFA Shades Mix
MistyRose #FFE4E1 Shades Mix
Moccasin #FFE4B5 Shades Mix
NavajoWhite #FFDEAD Shades Mix
Navy #000080 Shades Mix
OldLace #FDF5E6 Shades Mix
Olive #808000 Shades Mix
OliveDrab #6B8E23 Shades Mix
Orange #FFA500 Shades Mix
OrangeRed #FF4500 Shades Mix
Orchid #DA70D6 Shades Mix
PaleGoldenRod #EEE8AA Shades Mix
PaleGreen #98FB98 Shades Mix
PaleTurquoise #AFEEEE Shades Mix
PaleVioletRed #D87093 Shades Mix
PapayaWhip #FFEFD5 Shades Mix
PeachPuff #FFDAB9 Shades Mix
Peru #CD853F Shades Mix
Pink #FFC0CB Shades Mix
Plum #DDA0DD Shades Mix
PowderBlue #B0E0E6 Shades Mix
Purple #800080 Shades Mix
Red #FF0000 Shades Mix
RosyBrown #BC8F8F Shades Mix
RoyalBlue #4169E1 Shades Mix
SaddleBrown #8B4513 Shades Mix
Salmon #FA8072 Shades Mix
SandyBrown #F4A460 Shades Mix
SeaGreen #2E8B57 Shades Mix
SeaShell #FFF5EE Shades Mix
Sienna #A0522D Shades Mix
Silver #C0C0C0 Shades Mix
SkyBlue #87CEEB Shades Mix
SlateBlue #6A5ACD Shades Mix
SlateGray #708090 Shades Mix
Snow #FFFAFA Shades Mix
SpringGreen #00FF7F Shades Mix
SteelBlue #4682B4 Shades Mix
Tan #D2B48C Shades Mix
Teal #008080 Shades Mix
Thistle #D8BFD8 Shades Mix
Tomato #FF6347 Shades Mix
Turquoise #40E0D0 Shades Mix
Violet #EE82EE Shades Mix
Wheat #F5DEB3 Shades Mix
White #FFFFFF Shades Mix
WhiteSmoke #F5F5F5 Shades Mix
Yellow #FFFF00 Shades Mix
YellowGreen #9ACD32 Shades Mix
Note: The names above are not a part of the W3C web standard.
The W3C HTML and CSS standards have listed only 16 valid
color names:
aqua, black, blue, fuchsia, gray, green, lime, maroon, navy,
olive, purple, red, silver, teal, white, and yellow.
If you want valid HTML or CSS use the HEX values instead.
Color Names Supported by All Browsers
The list below is a complete list of the color names supported by
all major browsers.
You can click on a color name (or a hex value) to view the color
as the background-color along with different text colors.
Sorted by HEX Value
Link: Same list sorted by names
Color Name HEX Color Shades Mix
Black #000000 Shades Mix
Navy #000080 Shades Mix
DarkBlue #00008B Shades Mix
MediumBlue #0000CD Shades Mix
Blue #0000FF Shades Mix
DarkGreen #006400 Shades Mix
Green #008000 Shades Mix
Teal #008080 Shades Mix
DarkCyan #008B8B Shades Mix
DeepSkyBlue #00BFFF Shades Mix
DarkTurquoise #00CED1 Shades Mix
MediumSpringGreen #00FA9A Shades Mix
Lime #00FF00 Shades Mix
SpringGreen #00FF7F Shades Mix
Aqua #00FFFF Shades Mix
Cyan #00FFFF Shades Mix
MidnightBlue #191970 Shades Mix
DodgerBlue #1E90FF Shades Mix
LightSeaGreen #20B2AA Shades Mix
ForestGreen #228B22 Shades Mix
SeaGreen #2E8B57 Shades Mix
DarkSlateGray #2F4F4F Shades Mix
LimeGreen #32CD32 Shades Mix
MediumSeaGreen #3CB371 Shades Mix
Turquoise #40E0D0 Shades Mix
RoyalBlue #4169E1 Shades Mix
SteelBlue #4682B4 Shades Mix
DarkSlateBlue #483D8B Shades Mix
MediumTurquoise #48D1CC Shades Mix
Indigo #4B0082 Shades Mix
DarkOliveGreen #556B2F Shades Mix
CadetBlue #5F9EA0 Shades Mix
CornflowerBlue #6495ED Shades Mix
MediumAquaMarine #66CDAA Shades Mix
DimGray #696969 Shades Mix
SlateBlue #6A5ACD Shades Mix
OliveDrab #6B8E23 Shades Mix
SlateGray #708090 Shades Mix
LightSlateGray #778899 Shades Mix
MediumSlateBlue #7B68EE Shades Mix
LawnGreen #7CFC00 Shades Mix
Chartreuse #7FFF00 Shades Mix
Aquamarine #7FFFD4 Shades Mix
Maroon #800000 Shades Mix
Purple #800080 Shades Mix
Olive #808000 Shades Mix
Gray #808080 Shades Mix
SkyBlue #87CEEB Shades Mix
LightSkyBlue #87CEFA Shades Mix
BlueViolet #8A2BE2 Shades Mix
DarkRed #8B0000 Shades Mix
DarkMagenta #8B008B Shades Mix
SaddleBrown #8B4513 Shades Mix
DarkSeaGreen #8FBC8F Shades Mix
LightGreen #90EE90 Shades Mix
MediumPurple #9370D8 Shades Mix
DarkViolet #9400D3 Shades Mix
PaleGreen #98FB98 Shades Mix
DarkOrchid #9932CC Shades Mix
YellowGreen #9ACD32 Shades Mix
Sienna #A0522D Shades Mix
Brown #A52A2A Shades Mix
DarkGray #A9A9A9 Shades Mix
LightBlue #ADD8E6 Shades Mix
GreenYellow #ADFF2F Shades Mix
PaleTurquoise #AFEEEE Shades Mix
LightSteelBlue #B0C4DE Shades Mix
PowderBlue #B0E0E6 Shades Mix
FireBrick #B22222 Shades Mix
DarkGoldenRod #B8860B Shades Mix
MediumOrchid #BA55D3 Shades Mix
RosyBrown #BC8F8F Shades Mix
DarkKhaki #BDB76B Shades Mix
Silver #C0C0C0 Shades Mix
MediumVioletRed #C71585 Shades Mix
IndianRed #CD5C5C Shades Mix
Peru #CD853F Shades Mix
Chocolate #D2691E Shades Mix
Tan #D2B48C Shades Mix
LightGrey #D3D3D3 Shades Mix
PaleVioletRed #D87093 Shades Mix
Thistle #D8BFD8 Shades Mix
Orchid #DA70D6 Shades Mix
GoldenRod #DAA520 Shades Mix
Crimson #DC143C Shades Mix
Gainsboro #DCDCDC Shades Mix
Plum #DDA0DD Shades Mix
BurlyWood #DEB887 Shades Mix
LightCyan #E0FFFF Shades Mix
Lavender #E6E6FA Shades Mix
DarkSalmon #E9967A Shades Mix
Violet #EE82EE Shades Mix
PaleGoldenRod #EEE8AA Shades Mix
LightCoral #F08080 Shades Mix
Khaki #F0E68C Shades Mix
AliceBlue #F0F8FF Shades Mix
HoneyDew #F0FFF0 Shades Mix
Azure #F0FFFF Shades Mix
SandyBrown #F4A460 Shades Mix
Wheat #F5DEB3 Shades Mix
Beige #F5F5DC Shades Mix
WhiteSmoke #F5F5F5 Shades Mix
MintCream #F5FFFA Shades Mix
GhostWhite #F8F8FF Shades Mix
Salmon #FA8072 Shades Mix
AntiqueWhite #FAEBD7 Shades Mix
Linen #FAF0E6 Shades Mix
LightGoldenRodYellow #FAFAD2 Shades Mix
OldLace #FDF5E6 Shades Mix
Red #FF0000 Shades Mix
Fuchsia #FF00FF Shades Mix
Magenta #FF00FF Shades Mix
DeepPink #FF1493 Shades Mix
OrangeRed #FF4500 Shades Mix
Tomato #FF6347 Shades Mix
HotPink #FF69B4 Shades Mix
Coral #FF7F50 Shades Mix
Darkorange #FF8C00 Shades Mix
LightSalmon #FFA07A Shades Mix
Orange #FFA500 Shades Mix
LightPink #FFB6C1 Shades Mix
Pink #FFC0CB Shades Mix
Gold #FFD700 Shades Mix
PeachPuff #FFDAB9 Shades Mix
NavajoWhite #FFDEAD Shades Mix
Moccasin #FFE4B5 Shades Mix
Bisque #FFE4C4 Shades Mix
MistyRose #FFE4E1 Shades Mix
BlanchedAlmond #FFEBCD Shades Mix
PapayaWhip #FFEFD5 Shades Mix
LavenderBlush #FFF0F5 Shades Mix
SeaShell #FFF5EE Shades Mix
Cornsilk #FFF8DC Shades Mix
LemonChiffon #FFFACD Shades Mix
FloralWhite #FFFAF0 Shades Mix
Snow #FFFAFA Shades Mix
Yellow #FFFF00 Shades Mix
LightYellow #FFFFE0 Shades Mix
Ivory #FFFFF0 Shades Mix
White #FFFFFF Shades Mix
Note: The names above are not a part of the W3C web standard.
The W3C HTML and CSS standards have listed only 16 valid
color names:
aqua, black, blue, fuchsia, gray, green, lime, maroon, navy,
olive, purple, red, silver, teal, white, and yellow.
If you want valid HTML or CSS use the HEX values instead.
HTML Quick List from W3Schools. Print it, fold it, and put it in
your pocket.
<select>
<option>Apples</option>
<option selected="selected">Bananas</option>
<option>Cherries</option>
</select>
<textarea name="comment" rows="60" cols="20"></textarea>
</form>
Entities
< is the same as <
> is the same as >
© is the same as ©
Other Elements
<!-- This is a comment -->
<blockquote>
Text quoted from a source.
</blockquote>
<address>
Written by W3Schools.com<br />
<a href="mailto:[email protected]">Email us</a><br />
Address: Box 564, Disneyland<br />
Phone: +12 34 56 78
</address>
Source : http://www.w3schools.com/html/html_quick.asp
Everywhere on the Web you will find pages that are formatted
like newspaper pages using HTML columns.
Examples
Dividing a part of an HTML page into table columns is very
easy to do. To let you experiment with it, we have put together
this simple example.
HTML Joke
Student: "How do you spell HTML?"
With frames, you can display more than one Web page in the
same browser window.
Examples
Vertical frameset
This example demonstrates how to make a vertical frameset
with three different documents.
Horizontal frameset
This example demonstrates how to make a horizontal frameset
with three different documents.
(You can find more examples at the bottom of this page)
Frames
With frames, you can display more than one HTML document
in the same browser window. Each HTML document is called a
frame, and each frame is independent of the others.
The disadvantages of using frames are:
• The web developer must keep track of more HTML
documents
• It is difficult to print the entire page
More Examples
How to use the <noframes> tag
This example demonstrates how to use the <noframes> tag.
Mixed frameset
This example demonstrates how to make a frameset with three
documents, and how to mix them in rows and columns.
Frameset with noresize="noresize"
This example demonstrates the noresize attribute. The frames
are not resizable. Move the mouse over the borders between the
frames and notice that you can not move the borders.
Navigation frame
This example demonstrates how to make a navigation frame.
The navigation frame contains a list of links with the second
frame as the target. The file called "tryhtml_contents.htm"
contains three links. The source code of the links:
<a href ="frame_a.htm" target ="showframe">Frame a</a><br>
<a href ="frame_b.htm" target ="showframe">Frame b</a><br>
<a href ="frame_c.htm" target ="showframe">Frame c</a>
The second frame will show the linked document.
Inline frame
This example demonstrates how to create an inline frame (a
frame inside an HTML page).
Jump to a specified section within a frame
This example demonstrates two frames. One of the frames has a
source to a specified section in a file. The specified section is
made with <a name="C10"> in the "link.htm" file.
Jump to a specified section with frame navigation
This example demonstrates two frames. The navigation frame
(content.htm) to the left contains a list of links with the second
frame (link.htm) as a target. The second frame shows the linked
document. One of the links in the navigation frame is linked to a
specified section in the target file. The HTML code in the file
"content.htm" looks like this: <a href ="link.htm" target
="showframe">Link without Anchor</a><br><a href
="link.htm#C10" target ="showframe">Link with Anchor</a>.
Frame Tags
Tag Description
<frameset> Defines a set of frames
<frame> Defines a sub window (a frame)
Defines a noframe section for browsers that do not
<noframes>
handle frames
<iframe> Defines an inline sub window (frame)
The <font> tag in HTML is deprecated. It is supposed to be
removed in a future version of HTML.
Even if a lot of people are using it, you should try to avoid it,
and use styles instead.
<p>
<font size="3" face="Times">
This is another paragraph.
</font>
</p>
Try it yourself »
Font Attributes
Attribute Example Purpose
size="number" size="2" Defines the font size
size="+number" size="+1" Increases the font size
size="-number" size="-1" Decreases the font size
face="face-name" face="Times" Defines the font-name
color="color-value" color="#eeff00" Defines the font color
color="color-name" color="red" Defines the font color
With HTML 4.0 all formatting can be moved out of the HTML
document and into a separate style sheet.
Examples
Styles in HTML
This example demonstrates how to format an HTML document
with style information added to the <head> section.
Link that is not underlined
This example demonstrates how to make a link that is not
underlined, using a style attribute.
Link to an external style sheet
This example demonstrates how to use the <link> tag to link to
an external style sheet.
Inline Styles
An inline style should be used when a unique style is to be
applied to a single occurrence of an element.
To use inline styles you use the style attribute in the relevant tag.
The style attribute can contain any CSS property. The example
shows how to change the color and the left margin of a
paragraph:
<p style="color: red; margin-left: 20px">
This is a paragraph
</p>
To learn more about styles, visit our CSS tutorial.
Style Tags
Tag Description
<style> Defines a style definition
<link> Defines a resource reference
<div> Defines a section in a document
<span> Defines a section in a document
<font> Deprecated. Use styles instead
<basefont> Deprecated. Use styles instead
<center> Deprecated. Use styles instead
« Previous
With HTML 4.0 all formatting can be moved out of the HTML
document and into a separate style sheet.
Examples
Styles in HTML
This example demonstrates how to format an HTML document
with style information added to the <head> section.
Link that is not underlined
This example demonstrates how to make a link that is not
underlined, using a style attribute.
Link to an external style sheet
This example demonstrates how to use the <link> tag to link to
an external style sheet.
How to Use Styles
When a browser reads a style sheet, it will format the document
according to it. There are three ways of inserting a style sheet:
External Style Sheet
An external style sheet is ideal when the style is applied to many
pages. With an external style sheet, you can change the look of
an entire Web site by changing one file. Each page must link to
the style sheet using the <link> tag. The <link> tag goes inside
the head section.
<head>
<link rel="stylesheet" type="text/css"
href="mystyle.css">
</head>
Style Tags
Tag Description
<style> Defines a style definition
<link> Defines a resource reference
<div> Defines a section in a document
<span> Defines a section in a document
<font> Deprecated. Use styles instead
<basefont> Deprecated. Use styles instead
<center> Deprecated. Use styles instead
Non-breaking Space
The most common character entity in HTML is the non-
breaking space.
Normally HTML will truncate spaces in your text. If you write
10 spaces in your text HTML will remove 9 of them. To add lots
of spaces to your text, use the character entity.
Try It Yourself
This example lets you experiment with character entities: Try it
yourself
Head Tags
Tag Description
<head> Defines information about the document
<title> Defines the document title
<base> Defines a base URL for all the links on a page
<link> Defines a resource reference
<meta> Defines meta information
Tag Description
<!DOCTYPE> Defines the document type. This tag goes before
the <html> start tag.
Examples
Document description
Information inside a meta element describes the document.
Document keywords
Information inside a meta element describes the document's
keywords.
Redirect a user
This example demonstrates how to redirect a user if your site
address has changed.