HTML Page Structure
HTML Page Structure
HTML Tags
HTML tags are keywords (tag names) surrounded by angle brackets:
<tagname>content</tagname>
<html>
<head>
<title>Page title</title>
</head>
<body>
<h1>This is a heading</h1>
<p>This is a paragraph.</p>
</body>
</html>
The HTML <head> element contains meta data. Meta data are not displayed.
The HTML <head> element is placed between the <html> tag and the <body>
tag:
<head>
<title>My First HTML</title>
<meta charset="UTF-8">
</head>
The title will not be displayed in the document, but might be displayed in the
browser tab.
Title icon:
<link rel="short icon" href="image.png">
It can be used to define the character set, and other information about the
HTML document.
<meta charset="utf-8">
<h1>---------------------</h1>
<h2>---------------------</h2>
<h3>----------------------</h3>
<h4>-----------------------</h4>
<h5>------------------------</h5>
<h6>--------------------------</h6>
HTML Paragraphs
HTML paragraphs are defined with the <p> tag:
<p>-----------------------------
-----------------------------------</p>
<p>----------------------------------
---------------------------------------
----.</p>
Right to Left
<html dir="rtl">
<p dir="rtl">------------------------ </p>
Left to Right
<html dir="ltr">
<p dir="ltr">----------------------------- </p>
Alignment
<p align="left">Left aligned paragraph</p>
Font size
<font size="+4">Size 7</font><br>
<font size="+3">Size 6</font><br>
<font size="+2">Size 5</font><br>
<font size="+1">Size 4</font><br>
<font size=“+0">Size 3</font><br>
<font size="-1">Size 2</font><br>
<font size="-2">Size 1</font><br>
<big>size 4</big>
<small>size 2</small>
<big><big>size 5</big></big>
Use <br> if you want a line break (a new line) without starting a new
paragraph:
hr color:
<hr color="red">
hr size:
<hr width="300px">
<hr width="30%">
In this example, the <p> element has a title attribute. The value of
the attribute is
The HTML <strong> element defines strong text, with added semantic "strong"
importance.
<p>This text is normal.</p>
The HTML <em> element defines emphasized text, with added semantic
importance.
<address>
Written by my name.<br>
Visit us at:<br>
Example.com<br>
Box 564, Sana'a<br>
Yemen
</address>
<code>
var x = 5;
var y = 6;
document.getElementById("demo").innerHTML = x + y;
</code>
<kbd>File | Open...</kbd>
<samp>
demo.example.com login: Apr 12 09:10:17
Linux 2.6.10-grsec+gg3+e+fhs6b+nfs+gr0501+++p3+c4a+gr2b-
reslog-v6.189
</samp>
<p>This is a paragraph.</p>
The source file (src), alternative text (alt), and size (width and height)
are provided as attributes:
Alignment
<img src="folder/img.jpg" align="left">
<img src="folder/img.jpg " align="middle">
<img src="folder/img.jpg " align="right">
Border
<img src="folder/img.jpg " border="0">
HTML Lists
Unordered List:
Item
Item
Item
Item
Ordered List:
1. First item
2. Second item
3. Third item
4. Fourth item
The list items will be marked with bullets (small black circles):
<ul>
<li>Coffee</li>
<li>Tea</li>
<li>Milk</li>
</ul>
Type Description
Type=disc The list items will be marked with bullets (default)
Type=circle The list items will be marked with circles
Type=square The list items will be marked with squares
Type=none The list items will not be marked
<ul type="----">
<li>Coffee</li>
<li>Tea</li>
<li>Milk</li>
</ul>
<ol>
<li>Coffee</li>
<li>Tea</li>
<li>Milk</li>
</ol>
Type Description
type="1" The list items will be numbered with numbers (default)
type="A" The list items will be numbered with uppercase letters
type="a" The list items will be numbered with lowercase letters
type="I" The list items will be numbered with uppercase roman
numbers
type="i" The list items will be numbered with lowercase roman
numbers
<ol type="------">
<li>Coffee</li>
<li>Tea</li>
<li>Milk</li>
</ol>
<ul>
<li>Coffee</li>
<li>Tea
<ul>
<li>Black tea</li>
<li>Green tea</li>
</ul>
</li>
<li>Milk</li>
</ul>
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;