Lec 2-HTML
Lec 2-HTML
Objectives
2
Outline
1. Basic HTML
• hypertext
• tags & elements
• text formatting
• lists, hyperlinks, images
• tables
2. HTML5
3
Hypertext & HTML
•hypertext
•refers to the fact that Web pages are more than just
text
•can contain multimedia, provide links for jumping
within the same document & to other documents
4
Hypertext & HTML (cont.)
5
HTML Document Structure
6
<head> and <body> elements
•<head> element
• Title
• Cascading Style sheet information
• Metadata, such as who authored the page,
keywords
• JavaScript code
7
Tags and Elements
8
Text Layout
<!DOCTYPE html>
<html>
<body>
<p>
This paragraph
contains a lot of lines
but the browser
ignores it. <p>: defines a paragraph.
</p> A paragraph always starts on a
<p> new line, and browsers
This paragraph
contains a lot of spaces
automatically add some white
in the source code, space (a margin) before and after
but the browser a paragraph.
ignores it.
</p>
</body>
</html>
TRƯ Ờ NG CÔNG NGHỆ THÔNG TIN VÀ TRUYỀN THÔNG
School of Inform ation and Com m unication Technology
9
Text Layout
Tag Description
<p> Defines a paragraph
<hr> Defines a thematic change in the content
<br> Inserts a single line break
<pre> Defines pre-formatted text
10
Text Layout
</body>
</html>
11
The Basic Web page – A Worked Example
<!DOCTYPE html>
<html>
<head>
<title>SOICT</title>
</head>
<body>
<h1>SOICT</h1>
<h2>Introduction</h2>
<p>The educational philosophy is “Towards excellence in
digital age.”
</p>
<hr/>
<h2> Organizational structure</h2>
<p> 02 Departments;
04 Research Center;
02 Support Training, Scientific Research and
Technology Transfer Center;
01 Administration – office – Academic Affairs </p>
<hr/>
</body>
</html>
12
The Basic Web page – A Worked Example
13
Text Appearance
<!DOCTYPE html>
<html>
<body> •<b>… </b> specify bold
•<i>… </i> specify italics
<p><b>This text is bold</b></p>
<p><i>This text is italic</i></p> •<big>… </big> increase size
<p>This is<sub> subscript</sub>
•<small>… </small> decrease size
and <sup>superscript</sup></p> •<em>…</em> put emphasis
<p><em>This text is italic •<strong>…</strong> put emphasis
too</em></p> •<sub>… </sub> a subscript
</body> •<sup>… </sup> a superscript
</html>
14
Lists
<!DOCTYPE html>
<html>
<body>
<h2>An Unordered HTML List</h2>
<ul>
<li>Coffee</li>
<li>Tea</li>
<li>Milk</li>
</ul> • There are 3 different types:
<h2>An Ordered HTML List</h2> • <ol>…</ol>: an ordered list
<ol>
<li>Coffee</li>
• <li> identifies each list item
<li>Tea</li> • <ul>…</ul> unordered list
<li>Milk</li>
</ol> • <li> identifies each list item
• <dl>…</dl> a definition list
</body>
</html> • <dt> identifies each term
• <dd> identifies its definition
TRƯ Ờ NG CÔNG NGHỆ THÔNG TIN VÀ TRUYỀN THÔNG
School of Inform ation and Com m unication Technology
15
Hyperlinks
<!DOCTYPE html>
<html>
<body>
<h2>Absolute URLs</h2>
<a href="https://www.w3.org/">W3C</a>
<br>
<a
href="https://www.google.com/">Google</a>
<h2>Relative URLs</h2>
<a href="html_images.asp">HTML Images</a>
<br> • <a href="URL">…</a>
<a href="/css/default.asp">CSS
Tutorial</a>
</body>
</html>
16
Images
<!DOCTYPE html>
<html>
<body>
<h2>Image Size</h2>
</body>
</html>
17
Images (cont.)
18
Tables
<!DOCTYPE html>
<html>
<body>
<table>
<tr>
<th>MSSV</th>
<th>Lớp</th>
</tr> <table>…</table>: a table element
<tr>
<td>20202020</td> <th>...</th>: a header cell
<td>KHMT 01</td>
</tr> <tr>…</tr>: a row in the table
<tr>
<td>20212021</td> <td>…</td>: a cell
<td>Việt Nhật 02</td>
</tr>
</table>
</body>
</html>
TRƯ Ờ NG CÔNG NGHỆ THÔNG TIN VÀ TRUYỀN THÔNG
School of Inform ation and Com m unication Technology
19
Outline
1. Basic HTML
2. HTML5
20
TRƯ Ờ NG CÔNG NGHỆ THÔNG TIN VÀ TRUYỀN THÔNG
School of Inform ation and Com m unication Technology
21
HTML5 New Tags
22
HTML5 New Tags
Header
• section − a generic document or
Navigation application section. It can be used
together with h1-h6 to indicate the
Article
Section document structure.
Footer
• article − an independent piece of
Article content of a document, such as a blog
Asid entry or newspaper article.
e Footer
Footer
23
HTML5 New Tags
<audio controls="true">
<source src="audiodemo.ogg" />
<source src=" audiodemo.mp3" />
<source src=" audiodemo.wav" />
Not supported.
</audio>
24
HTML5 New Tags
• <canvas> element:
function draw() {
var ctx =
document.getElementById('canvas').getContext('2d');
var img = new Image();
img.onload = function(){
ctx.drawImage(img,0,0);
ctx.beginPath();
ctx.moveTo(30,96);
ctx.lineTo(70,66);
ctx.lineTo(103,76);
ctx.lineTo(170,15);
ctx.stroke();
}
img.src = 'images/backdrop.png';
}
25
HTML5 New Tags
month
button number
checkbox password
color radio
date range
datetime reset
datetime-local search
email submit
file tel
hidden text
image time
url
week
26
Google page history
1997 1998
1999
TRƯ Ờ NG CÔNG NGHỆ THÔNG TIN VÀ TRUYỀN THÔNG
School of Inform ation and Com m unication Technology
2000
27
Google page history
2001 2002
2003
TRƯ Ờ NG CÔNG NGHỆ THÔNG TIN VÀ TRUYỀN THÔNG
2004
School of Inform ation and Com m unication Technology
28
Google page history
2005
2006
2007 2025
TRƯ Ờ NG CÔNG NGHỆ THÔNG TIN VÀ TRUYỀN THÔNG
School of Inform ation and Com m unication Technology
29