HTML, Which Stands For Hypertext Markup Language, Is The Predominant Markup Language
HTML, Which Stands For Hypertext Markup Language, Is The Predominant Markup Language
for web pages. HTML is the basic building-blocks of webpages. A markup language is a set of markup tags,
and HTML uses markup tags to describe web pages.
HTML is written in the form of HTML elements consisting of tags, enclosed in angle brackets (like <html>),
within the web page content. HTML tags normally come in pairs like <h1> and </h1>. The first tag in a
pair is the start tag, the second tag is the end tag (they are also called opening tags and closing tags).
The purpose of a web browser is to read HTML documents and compose them into visual or audible web
pages. The browser does not display the HTML tags, but uses the tags to interpret the content of the page.
HTML elements form the building blocks of all websites. HTML allows images and objects to be embedded
and can be used to create interactive forms. It provides a means to create structured documents by
denoting structural semantics for text such as headings, paragraphs, lists, links, quotes and other items. It
can embed scripts in languages such as JavaScript which affect the behavior of HTML webpages.
Web browsers can also refer to Cascading Style Sheets (CSS) to define the appearance and layout of text
and other material. The W3C, maintainer of both the HTML and the CSS standards, encourages the use of
CSS over explicitly presentational HTML markup.[1]
HTML markup consists of several key components, including elements (and their attributes), character-
based data types, character references and entity references. Another important component is the
document type declaration, which specifies the Document Type Definition. As of HTML 5, no Document
Type Definition will need to be specified and will only determine the layout mode.[41]
The Hello world program, a common computer program employed for comparing programming languages,
scripting languages and markup languages is made of 9 lines of code although in HTML newlines are
optional:
<!doctype html>
<html>
<head>
<title>Hello HTML</title>
</head>
<body>
<p>Hello World!</p>
</body>
</html>
(The text between <html> and </html> describes the web page, and The text between <body> and
</body> is the visible page content.)
This Document Type Declaration is for HTML 5. If the <!doctype html> declaration is not included,
Windows Internet Explorer
will render using "quirks mode".[42]
[edit] Elements
Main article: HTML element
HTML documents are composed entirely of HTML elements that, in their most general form have three
components: a pair of element tags, a "start tag" and "end tag"; some element attributes within the start
tag; and finally, any textual and graphical content between the start and end tags. The HTML element is
everything between and including the tags. Each tag is enclosed in angle brackets.
The general form of an HTML element is therefore: <tag attribute1="value1"
attribute2="value2">content to be rendered</tag> The name of the HTML element is also the name of
the tag. Note that the end tag's name is preceded by a slash character, "/". If attributes are not assigned,
default values are used.
[edit] Element examples
Header of the HTML document:<head>...</head>. Usually the title should be included in the head, for
example:
<head>
<title>The title</title>
</head>
Headings: HTML headings are defined with the <h1> to <h6> tags:
<h1>Heading1</h1>
<h2>Heading2</h2>
<h3>Heading3</h3>
<h4>Heading4</h4>
<h5>Heading5</h5>
<h6>Heading6</h6>
Paragraphs:
<p>Paragraph 1</p> <p>Paragraph 2</p>
Line breaks:<br>. The difference between <br> and <p> is that 'br' breaks a line without altering the
semantic structure of the page, whereas 'p' sections the page into paragraphs. Note also that 'br' is an
empty element in that, while it may have attributes, it can take no content or end tag.
<p>This <br> is a paragraph <br> with <br> line breaks</p>
heading
1
heading
<h1> 2 <h1>Heading 1 Example</h1>
<h2> heading <h2>Heading 2 Example</h2>
<h3> 3 <h3>Heading 3 Example</h3>
<h4> heading <h4>Heading 4 Example</h4>
<h5> 4 <h5>Heading 5 Example</h5>
<h6> heading <h6>Heading 6 Example</h6>
5
heading
6
Example 1:
<menu>
<li type="disc">List item 1</li> • List item 1
<li type="circle">List item 2</li>
<li type="square">List item 3</li>
</MENU> o List item 2
Example 2:
List item 3
Example 2:
<ol type="i">
<li>List item 1</li>
<li>List item 2</li>
<li>List item 3</li>
i. List item 1
<li>List item 4</li> ii. List item 2
</ol>
iii. List item 3
<head>
<link rel="stylesheet" type="text/css" href="style.css"
<link> link
/>
</head>
<marque
<marquee bgcolor="#cccccc" loop="-1"
e> scrolling
scrollamount="2" width="100%">Example
(Internet text
Marquee</marquee>
Explorer)
(Tip)
• List item 1
<menu>
<li type="disc">List item 1</li>
<menu> menu <li type="circle">List item 2</li> o List item 2
<li type="square">List item 3</li>
</menu>
List item 3
X. List item 4
<ol type="I" start="7">
<li>List item 1</li>
<li>List item 2</li>
<li>List item 3</li>
<li>List item 4</li>
</ol>
<form method=post action="/cgi-bin/example.cgi">
<center>
Select an option:
<select>
<option>option 1</option>
<option selected>option 2</option>
<option listbox
<option>option 3</option>
> option
<option>option 4</option>
<option>option 5</option>
<option>option 6</option>
</select><br>
</center>
</form>
This is an example displaying the use
This is an example displaying the use of the paragraph of the paragraph tag.
tag. <p> This will create a line break and a space
between lines.
This will create a line break and a
Attributes: space between lines.
Example 3:
Example 3: (Tip)
<table cellpadding="2" cellspacing="2"
width="100%">
<tr> Column 1 Column 2
<td bgcolor="#cccccc">Column 1</td>
<td bgcolor="#cccccc">Column 2</td> Row 2 Row 2
</tr>
<tr>
<td>Row 2</td>
<td>Row 2</td>
</tr>
</table>
<table border="2" cellpadding="2" cellspacing="2"
width="100%">
<tr>
table
<td> <td>Column 1</td>
data Column 1 Column 2
<td>Column 2</td>
</tr>
</table>
<div align="center"> Colum Colum Colum
<table> n1 n2 n3
<tr> Row 2 Row 2 Row 2
<th>Column 1</th>
Row 3 Row 3 Row 3
<th>Column 2</th>
<th>Column 3</th>
Row 4 Row 4
Row
</tr>
<tr> 4
<td>Row 2</td>
<td>Row 2</td>
<td>Row 2</td>
table </tr>
<th>
header <tr>
<td>Row 3</td>
<td>Row 3</td>
<td>Row 3</td>
</tr>
<tr>
<td>Row 4</td>
<td>Row 4</td>
<td>Row 4</td>
</tr>
</table>
</div>
documen Title of your web page will be viewable
<title> <title>Title of your HTML page</title>
t title in the title bar. (Tip)
<table border="2" cellpadding="2" cellspacing="2"
Column 1 Column 2
width="100%">
<tr>
<tr> table row <td>Column 1</td>
<td>Column 2</td>
</tr>
</table>
<tt> teletype <tt>Example</tt> Example
<u> underline <u>Example</u> Example
Example 1:
Example 1:<br>
<br>
<ul> • List item 1
<li>List item 1</li> • List item 2
<li>List item 2</li>
</ul>
<br>
unordere Example 2:<br> Example 2:
<ul>
d list <ul type="disc">
<li>List item 1</li>
<li>List item 2</li> • List item 1
<ul type="circle">
<li>List item 3</li> • List item 2
<li>List item 4</li> o List item 3
</ul>
</ul>
o List item 4