Professional Documents
Culture Documents
By:
Dr Amira Ibrahim Abdelatey
Amira.Mohamed@ci.menofia.edu.eg
Overview of today’s lecture
• Introduction
• Basic tags
• Attributes
• Text formatting
• Images
• Links
• Lists
• Tables
• Forms
What is HTML?
5
Web Browsers
6
HTML Editor
9
Tags
• There are opening and closing tags for many but not
all tags; The affected text is between the two tags
More Tags...
Example:
<H1> <I> The Nation </I> </H1>
Structure of a Web Page
<HTML>
• All Web pages share <HEAD>
a common structure <TITLE> Example </TITLE>
</HEAD>
• All Web pages <BODY>
should contain a This is where you would
pair of <HTML>, include the text and
images on your Web page.
<HEAD>, <TITLE>,
and <BODY> tags </BODY>
</HTML>
HTML Documents
14
The <!DOCTYPE> Declaration
<!DOCTYPE html> 15
HTML Headings
<p>This is a paragraph.</p>
<p>This is another paragraph.</p>
17
The <TITLE> Tag
19
Never Skip the End Tag
<html>
<body>
<p>This is a paragraph
<p>This is a paragraph
</body>
</html>
21
HTML is Not Case Sensitive
22
HTML Attributes
23
The href Attribute
<!DOCTYPE html>
<html>
<body>
<h2>The href Attribute</h2>
<p>HTML links are defined with the a tag.
The link address is specified in the href
attribute:</p>
<a href="https://www.google.com">Visit
Google</a> 24
</body>
The src Attribute
<!DOCTYPE html>
<html>
<body>
<h2>The src Attribute</h2>
<p>HTML images are defined with the img tag:</p>
<img src="img_girl.jpg" width="500"
height="600">
25
</body>
The width and height Attributes
27
The alt Attribute
29
The lang Attribute
<!DOCTYPE html>
<html lang="en">
<body>
...
</body> 30
</html>
HTML Horizontal Rules
The <br> tag is an empty tag, which means that it has no end
tag. 35
The Poem Problem
<p>
My Bonnie lies over the ocean.
36
Solution - The HTML <pre> Element
<pre>
My Bonnie lies over the ocean.
</pre>
The HTML Style Attribute
<tagname style="property:value;">
<!DOCTYPE html>
<html>
<body>
<p>I am normal</p>
<p style="color:red;">I am red</p>
<p style="color:blue;">I am blue</p>
<p style="font-size:50px;">I am big</p>
</body>
</html>
39
Background Color
Example:
Set the background color for a page to powderblue:
<body style="background-
color:powderblue;">
<h1>This is a heading</h1>
<p>This is a paragraph.</p>
40
</body>
Background Color
<!DOCTYPE html>
<html>
<body>
<h1 style="background-color:powderblue;">This is a
heading</h1>
<p style="background-color:tomato;">This is a paragraph.</p>
</body>
</html>
41
Text Color
42
Fonts
43
Text Size
44
Text Alignment
45
HTML Text Formatting
Formatting elements were designed to display special
types of text:
• <b> - Bold text
• <strong> - Important text
• <i> - Italic text
• <em> - Emphasized text
• <mark> - Marked text
• <small> - Smaller text
• <del> - Deleted text
• <ins> - Inserted text
• <sub> - Subscript text
• <sup> - Superscript text
46
Text Formatting Tags
48
HTML <del> Element
49
HTML <ins> Element
50
HTML <sub> Element
51
HTML <sup> Element
52
HTML Comments
53
HTML Colors
55
Text Color
56
Border Color
57
Color Values
58
Example
<!DOCTYPE html>
<html>
<body>
<p>Same as color name "Tomato":</p>
<h1 style="background-color:rgb(255, 99, 71);">rgb(255, 99,
71)</h1>
<h1 style="background-color:#ff6347;">#ff6347</h1>
<h1 style="background-color:hsl(9, 100%, 64%);">hsl(9, 100%,
64%)</h1>
<p>Same as color name "Tomato", but 50% transparent:</p>
<h1 style="background-color:rgba(255, 99, 71, 0.5);">rgba(255, 99,
71, 0.5)</h1>
<h1 style="background-color:hsla(9, 100%, 64%, 0.5);">hsla(9,
59
100%, 64%, 0.5)</h1>
Shades of Gray
<!DOCTYPE html>
<html>
<body>
<h1 style="background-color:rgb(60, 60, 60);">rgb(60, 60, 60)</h1>
<h1 style="background-color:rgb(100, 100, 100);">rgb(100, 100, 100)</h1>
<h1 style="background-color:rgb(140, 140, 140);">rgb(140, 140, 140)</h1>
<h1 style="background-color:rgb(180, 180, 180);">rgb(180, 180, 180)</h1>
<h1 style="background-color:rgb(200, 200, 200);">rgb(200, 200, 200)</h1>
<h1 style="background-color:rgb(240, 240, 240);">rgb(240, 240, 240)</h1>
</body>
</html>
60
HTML Links
61
HTML Links - Syntax
The most important attribute of the <a> element is the href attribute, which indicates
the link's destination.
The link text is the part that will be visible to the reader.
Clicking on the link text, will send the reader to the specified URL address.
62
HTML Links
63
HTML Links - The target Attribute
64
Example
<!DOCTYPE html>
<html>
<body>
<h2>Absolute URLs</h2>
<p><a
href="https://www.google.com/">Google</a></p>
<h2>Relative URLs</h2>
<p><a href="html_images.asp">HTML Images</a></p> 66
HTML Links - Use an Image as a Link
<a href="default.asp">
<img src="smiley.gif" alt="HTML tutorial"
style="width:42px;height:42px;">
</a>
67
Link to an Email Address
68
HTML Tables
69
HTML Tables
70
Example
<table>
<tr>
<th>Person 1</th>
<th>Person 2</th>
<th>Person 3</th>
</tr>
<tr>
<td>Emil</td>
<td>Tobias</td>
<td>Linus</td>
</tr>
<tr>
<td>16</td>
<td>14</td>
<td>10</td>
</tr> 71
</table>
72