Unit 2 HTML
Unit 2 HTML
HTML
Outline
<!DOCTYPE HTML>
<html>
Opening tag
<head>
<title>My First HTML Page</title>
</head>
<body> Closing tag
<p>This is some text...</p>
</body>
</html>
An HTML element consists of an opening tag, a closing tag and the content inside.
First HTML Page: Header
<!DOCTYPE HTML>
HTML header
<html>
<head>
<title>My First HTML Page</title>
</head>
<body>
<p>This is some text...</p>
</body>
</html>
First HTML Page: Body
<!DOCTYPE HTML>
<html>
<head>
<title>My First HTML Page</title>
</head>
<body>
<p>This is some text...</p>
</body>
</html>
HTML body
First HTML Page
test.html
<!DOCTYPE HTML>
<html>
<head>
<title>My First HTML Page</title>
</head>
<body>
<p>This is some text...</p>
</body>
</html>
Basic HTML Tags
1. Headings
2. Paragraph
3. Colors
4. Fonts
5. List
6. Anchor Tag
7. Image
8. Table
9. Form
1) Headings
Headings are important because search engines use
the headings to index the structure and content of
your web pages.
Unordered List
• Block-A o Block-A Block-A
• Block-B o Block-B Block-B
• Block-C o Block-C Block-C
• Block-D o Block-D Block-D
5.1) Ordered List
<ol>
<li> Item one </li>
Types:
<li> Item two </li>
<ol type="I" > Type = 1 (default)
<li> Sublist item one </li> Type = a
<li> Sublist item two </li> Type = A
<ol type="i"> Type = I
<li> Sub-sub list item one </li> Type = i
<li> Sub-sub list item two </li>
</ol> Output
</ol>
</ol>
5.2) Unordered List
<ul>
<li> One </li>
Types:
<li> Two </li>
<ul type="circle"> Type = disc (default)
<li> Three </li> Type = circle
<li> Four </li> Type = square
<ul type="square">
<li> Five </li>
<li> Six </li>
</ul> Output
</ul>
</ul>
6) <a> Anchor Tag (Hyperlinks)
The <a> tag defines a hyperlink, which is used to link from one
page to another.
Syntax :
<img src=“PathToImage”/>
src is required
alt will specify the text to display if the Image not found
width, height may be in units of pixels or percentage of page
or frame
• width="357"
• height="50%“
Images (cont.)
Submit Button
• Submit button is used to submit the data
to the form action url.
• Example :
<input type=“submit” value=“Add City”>
Introduction to XHTML
Problems were initially caused in the development of HTML by a
lack of standards.
Browser makers tended to add proprietary extensions that limited
those who could see the sites in the way that was intended .
This was been termed the “browser wars” of 1990s.
The World Wide Web Consortium (W3C) became the main source
for standards that browsers were to follow.
Introduction to XHTML (Cont.)
The evolution of HTML led to the separation of formatting
instructions from content, leading to the development of CSS.
HTML was redeveloped as XHTML, using XML to apply more strict
approach to web coding.
XHTML provides a more stable platform for CSS
XHTML
XHTML stands for EXtensible HyperText Markup Language
XHTML is almost identical to HTML 4.01
XHTML is a stricter and cleaner version of HTML 4.01
XHTML is HTML defined as an XML application
XHTML is supported by all major browsers.
Characteristics of XHTML
DOCTYPE is mandatory
XML namespace attribute in <html> is mandatory
<html>, <head>, <title>, and <body> is mandatory
elements must be properly nested
elements must always be closed
elements must be in lower case
documents must have one root element
Attribute names must be in lower case
Attribute values must be quoted
Attribute abbreviation is forbidden
XHTML DOCTYPE
An XHTML document must have an XHTML DOCTYPE declaration.
XHTML 1.0 document type definitions are corresponds to four
Dtds:
• Strict
• Basic
• Transitional
• Frameset
The most commonly used is the XHTML Transitional document.
XHTML DOCTYPE (Cont.)
XHTML 1.0 Strict: This DTD contains all HTML elements and attributes,
<!DOCTYPE html but does NOT INCLUDE presentational or deprecated
PUBLIC "-//W3C//Dtd XHTML 1.0 Strict//EN"
elements (like font). Framesets are not allowed.
"http://www.w3.org/tr/xhtml1/Dtd/xhtml1-strict.dtd">
XHTML 1.0 Transitional: This DTD contains all HTML elements and attributes,
<!DOCTYPE html INCLUDING presentational and deprecated elements
(like font). Framesets are not allowed.
PUBLIC "-//W3C//Dtd XHTML 1.0 Transitional//EN"
"http://www.w3.org/tr/xhtml1/Dtd/xhtml1-transitional.dtd">
XHTML 1.0 Basic: This DTD is equal to XHTML 1.0 Strict, but allows you
<!DOCTYPE html to add modules (for example to provide ruby
PUBLIC "-//W3C//Dtd XHTML 1.0 Basic//EN"support for East-Asian languages).
"http://www.w3.org/tr/xhtml1/Dtd/xhtml1-basic10.dtd">
XHTML 1.0 Frameset: This DTD is equal to XHTML 4.01 Transitional, but
<!DOCTYPE html allows the use of frameset content.
PUBLIC "-//W3C//Dtd XHTML 1.0 Frameset//EN"
"http://www.w3.org/tr/xhtml1/Dtd/xhtml1-frameset.dtd">
XHTML Document Structure
A basic XHTML document consists of the following main parts:
• xml version
• The DOCTYPE (Dtd)
• html document root
• xmlns attribute for the html element
• head element with a child title element
• body element
XHTML Document Structure (Ex.)
<?xml version="1.0" ?>
<!DOCTYPE HTML PUBLIC "-//W3C//Dtd XHTML 1.00 Strict//EN"
"http://www.w3.org/tr/xhtml1/Dtd/xhtml1-strict.dtd">
<html xmlns="http://www.w3.org/1999/xhtml">
<head>
<title>Hello</title>
</head>
<body>
helloooooooo
</body>
</html>
META Tag
Metadata is data (information) about data.
The <meta> tag provides metadata about the HTML document.
Metadata will not be displayed on the page.
Meta elements are typically used to specify page description,
keywords, author of the document, last modified and other
metadata.
The metadata can be used by search engines (keywords),
browsers (how to display content or reload page) or other web
services.
Meta Tag Attributes
Attribute Value Description
Charset Character_set Specifies the character encoding for the HTML document
author
description
name keywords Specifies a name for the metadata
robots
expires
content-type
Provides an HTTP header for the information/value of the
http-equiv default-style
content attribute
refresh
Gives the value associated with the http-equiv or name
content text
attribute
format/URI Not supported in HTML5. Specifies a scheme to be used to
scheme
USA/Europe interpret the value of the content attribute
Character Entities
• Character entities are used to display reserved characters in HTML.
• Characters that are not present on your keyboard can also be
replaced by entities.
Character Character Entity Description
Space
& & Ampersand
“ " Quote
< < Less than
> > Greater than
© © Copyright
® ® Registered
™ ™ Trademark
£ £ Pound
¢ ¢ Cent
45
÷ ÷ Divide
Keyboard and How Browser Works ?
Mouse
Output
To
HTML Interpreter Display
Controller Display
Plug-Ins/ Drivers
Other Interpreter
Response
from web
server
Other
Clients Network
HTTP Interface
Client Communicati
on with web
server
Introduction to HTML 5
The DOCTYPE declaration for HTML5 is very simple:
<!DOCTYPE html>
The character encoding (charset) declaration is also very simple:
<meta charset="UTF-8">
New HTML5 Elements:
• New semantic elements like <header>, <footer>, <article>, and <section>.
• New form control attributes like number, date, time, calendar, and range.
• New graphic elements: <svg> and <canvas>.
• New multimedia elements: <audio> and <video>.
• Some Elements Removed in HTML5
Introduction to HTML 5 (cont.)
The following HTML4 elements have been removed from HTML5:
<font> CSS