Introduction To HTML
Introduction To HTML
What is HTML?
HTML is a language for describing web pages.
• HTML stands for Hyper Text Markup Language
• HTML is not a programming language, it is a markup language
• A markup language is a set of markup tags
• HTML uses markup tags to describe web pages
HTML Tags
HTML markup tags are usually called HTML tags
• HTML tags are keywords surrounded by angle brackets like <html>
• HTML tags normally come in pairs like <b> and </b>
• The first tag in a pair is the start tag, the second tag is the end tag
• Start and end tags are also called opening tags and closing tags
HTML Documents = Web Pages
• HTML documents describe web pages
• HTML documents contain HTML tags and plain text
• HTML documents are also called web pages
The purpose of a web browser (like Internet Explorer or Firefox) is to read HTML documents
and display them as web pages. The browser does not display the HTML tags, but uses the tags
to interpret the content of the page
My First Html Page:
<html>
<body>
</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
Making it Work :
• Text editor (text pad) , save the file as .htm or .html
• Tool , Dreamweaver , Frontpage
Lesson Two :
HTML Elements
An HTML element is everything from the start tag to the end tag:
Start tag Element content End tag
<p> This is a paragraph </p>
<a href="default.htm" > This is a link </a>
<br />
<html>
<body>
</body>
</html>
HTML Paragraphs
HTML paragraphs are defined with the <p> tag.
<html>
<body>
<p>This is a paragraph.</p>
<p>This is another paragraph.</p>
</body>
</html>
HTML Links
HTML links are defined with the <a> tag.
<html>
<body>
<a href="http://www.drmossab.info">Dr. Mossab Website </a>
</body>
</html>
HTML Images
HTML images are defined with the <img> tag.
<html>
<body>
<img src="Ajman.jpg" width="104" height="142" />
</body>
</html>
HTML Lines
The <hr /> tag creates a horizontal line in an HTML page.
HTML break
<br /> Inserts a single line break
HTML Text Formatting
<html>
<body>
This text is bold
<p><b>This text is bold</b></p> This text is strong
This text is big
<p><strong>This text is strong</strong></p> This text is emphasized
This text is italic
<p><big>This text is big</big></p> This text is small
This is subscript and superscript
<p><em>This text is emphasized</em></p>
</body>
</html>
<html> This is
</pre> next i
<pre>
for i = 1 to 10
print i
next i
</pre>
</body>
</html>
<html>
<br />
<tt>Teletype text</tt>
<br />
<samp>Sample text</samp>
<br />
<var>Computer variable</var>
<br />
</body>
</html>
<html>
<body> Written by Ajman University
Email us
Address: Box 564, Ajman, UAE
Phone: +971500500
<address>
<a href="mailto:us@ajman.ac.ae">Email
us</a><br />
Phone: +971500500
</address>
</body>
</html>
<html>
</body>
</html>
<html> If your browser supports bi-directional
<body> override (bdo), the next line will be written
from the right to the left (rtl):
txet werbeH emos si ereH
<p>
</p>
<bdo dir="rtl">
</bdo>
</body>
</html>
<html> A long quotation:
</body>
</html>
<html>
</body>
</html>
<html>
<p style="font-family:times;color:green">
</body>
</html>
<html>
This is a heading
<body style="background-color:yellow">
This is a paragra
<h2 style="background-color:red">This is a
heading</h2>
<p style="background-color:green">This is a
paragraph.</p>
</body>
</html>
<html>
This is a heading
This is a paragraph.
<body bgcolor="yellow"> The old bgcolor attribute only works on the
body element.
<h2>This is a heading</h2>
For future proof HTML, use styles instead:
<p>This is a paragraph.</p>
</body>
</html>
<body> A heading
<h1 style="font-family:verdana">A A paragraph.
heading</h1>
<p style="font-family:arial;color:red;font-
size:20px;">A paragraph.</p>
</body>
</html>
<html>
<body> A heading
A paragraph.
<h1><font face="verdana">A
heading</font></h1>
</body>
</html>
<html>
</body>
</html>
<html>
</body>
</html>
Examples Summary:
HTML Text Formatting Tags
Tag Description
<b> Defines bold text
<big> Defines big text
<em> Defines emphasized text
<i> Defines italic text
<small> Defines small text
<strong> Defines strong text
<sub> Defines subscripted text
<sup> Defines superscripted text
<ins> Defines inserted text
<del> Defines deleted text
<html>
<body>
An image with align="bottom".
<p>An image
with align="middle".</p>
An image after the text.
<p>An image
with align="top".</p>
</body>
</html>
</p>
<p>
</p>
</body>
</html>
<html>
</a></p>
<a href="http://www.drmossab.info">
</a></p>
</body>
</html>
<tr>
<td>100</td>
</tr>
</table>
<table border="1">
<tr>
<td>100</td>
<td>200</td>
<td>300</td>
</tr>
</table>
<html>
With a normal border:
<body> First Row
Secon
Row
d
<h4>With a normal border:</h4>
With a thick border:
<table border="1"> First Row
<tr> Secon
Row
d
<td>First</td>
<td>Second</td>
<td>Row</td>
</tr>
</table>
<table border="8">
<tr>
<td>First</td>
<td>Row</td>
</tr>
<tr>
<td>Second</td>
<td>Row</td>
</tr>
</table>
<tr>
<td>First</td>
<td>Row</td>
</tr>
<tr>
<td>Second</td>
<td>Row</td>
</tr>
</table>
</body>
</html>
<table border="1">
<tr> Header 1 Header 2
<th>Header 1</th> row 1, cell 1 row 1, cell 2
<th>Header 2</th> row 2, cell 1 row 2, cell 2
</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>
<html>
Without cellpadding:
<body> First Row
Secon
Row
d
<h4>Without cellpadding:</h4>
<table border="1">
With cellpadding:
<tr>
First Row
<td>First</td>
<td>Row</td> Secon
Ro
d
</tr>
<tr>
<td>Second</td>
<td>Row</td>
</tr>
</table>
<h4>With cellpadding:</h4>
<table border="1"
cellpadding="10">
<tr>
<td>First</td>
<td>Row</td>
</tr>
<tr>
<td>Second</td>
<td>Row</td>
</tr>
</table>
</body>
</html>
HTML Lists
An ordered list: An unordered list:
1. The first list item • List item
2. The second list item • List item
3. The third list item • List item
<ul> • Coffee
<li>Coffee</li>
<li>Milk</li> • Milk
</ul>
<ol> 1. Coffee
<li>Coffee</li>
<li>Milk</li> 2. Milk
</ol>
<dl> – Coffee
<dt>Coffee</dt>
<dd>- black hot drink</dd>
– Milk
<dt>Milk</dt>
<dd>- white cold drink</dd>
</dl>
<html>
A nested List:
<body> • Coffee
• Tea
○ Black tea
<h4>A nested List:</h4>
○ Green tea
<ul>
• Mil
<li>Coffee</li>
<li>Tea
<ul>
<li>Black tea</li>
<li>Green tea</li>
</ul>
</li>
<li>Milk</li>
</ul>
</body>
</html>
HTML forms
Html forms are used to pass data to a server.
A form can contain input elements like text fields, checkboxes, radio-buttons, submit buttons and
more. A form can also contain select lists, textarea, fieldset, legend, and label elements.
The <form> tag is used to create an HTML form:
<form> How the HTML code above looks in a
First name: <input type="text"
browser:
name="firstname" /><br />
Top of Form
Last name: <input type="text"
name="lastname" />
</form>
First name:
Last name:
Bottom of Form
Note: The form itself is not visible. Also note
that the default width of a text field is 20
characters.
</form>
Dropdown List
<html>
<body>
<form action="">
<select name="cars">
<option value="volvo">Volvo</option>
<option value="saab">Saab</option>
<option value="fiat">Fiat</option>
<option value="audi">Audi</option>
</select>
</form>
</body>
</html>
Text Area
<html>
<body>
</textarea>
</body>
</html>
Button
<html>
<body>
<form action="">
<input type="button" value="Hello
world!">
</form>
</body>
</html>