Introduction To XHTML: Part 1 of 2
Introduction To XHTML: Part 1 of 2
Introduction to XHTML
Part 1 of 2
pejal71@gmail.com
Objectives
► identify
important components of XHTML
document
2 of 17
Agenda
► Whatis XHTML?
► XHTML is a Web Standard
► Why XHTML?
► XHTML vs. HTML
► XHTML syntax (intro - part 1)
3 of 17
What is XHTML?
► stands for EXtensible Hypertext Markup
Language
► aimed to replace HTML
► almost identical to HTML 4.01
► stricter and cleaner version of HTML
4 of 17
XHTML is a Web standard
► XHTML 1.0 became an official W3C
Recommendation on January 26, 2000
► the specification is stable
► has been reviewed by the W3C membership
► the specification is now a Web standard
5 of 17
Why XHTML?
<html>
<head>
<title>This is bad HTML </title>
<body>
<h1>Bad HTML
</body>
6 of 17
… Why XHTML?
► we need a "well-formed" document. why?
– different browser technologies
– some browsers run on computers, some
browsers run on mobile phones and some on
palm pilots (do you know this?)
– problem in interpreting a "bad" markup
language
7 of 17
Differences between XHTML & HTML?
8 of 17
XHTML Documents must be
properly nested
► inHTML, some elements can be improperly
nested within each other like this:
9 of 17
XHTML Documents must be
well-formed
► must be nested within the <html> root element
► all other elements can have sub (children)
elements
► sub elements must be in pairs and correctly
nested within their parent elements.
► below is the basic document structure:
<html>
<head>. . . </head>
<body>. . . </body>
</html>
10 of 17
Tag Names Must Be in Lower Case
► XHTML documents are XML applications
► XML is case-sensitive
► tags like <br> and <BR> are interpreted as
different tags
11 of 17
ALL XHTML Elements
Must Be Closed
► non-empty elements must have an end tag
► empty elements must also be closed
12 of 17
XHTML Basic Syntax
► an XHTML documents consists of 3 main parts
1. the DOCTYPE
2. the head
3. the body
► the basic document structure is:
<?xml . . . >
<!DOCTYPE . . . >
<html>
<head> <title>... </title> </head>
<body> ... </body>
</html>
13 of 17
…XHTML Basic Syntax
► theDOCTYPE declaration should always be in the
second line after XML declaration.
► <html> tag is a must
14 of 17
XHTML <!DOCTYPE>
15 of 17
More XHTML Tags:
► comment ► ... more tags in the
► header next class
► paragraph ► homework: write an
► break
XHTML document
about yourself. you
► horizontal bar can include your
► bold, italic, font photo, strengths,
► list weaknesses, email
► link address etc. save your
document as
► images
your_id.html
16 of 17
Resources
► XHTML Tutorial
http://www.w3schools.com/tags/default.asp
► The W3C Markup Validaton Service
http://validator.w3.org/
17 of 17