SlideShare a Scribd company logo
XHTML
Introduction to XHTML
Extensible HyperText Markup Language
XHTML vs HTML
XHTML:
Separating structure and presentation (use CSS)
A valid XHTML document allows only its content and
structure
HTML
Can still contain formatting elements
First XHTML Example
<?xml version = "1.0"?>
<!DOCTYPE html PUBLIC "-//W3C//DTD XHTML 1.0 Transitional//EN"
"http://www.w3.org/TR/xhtml1/DTD/xhtml1-transitional.dtd">
<html xmlns = "http://www.w3.org/1999/xhtml">
<head>
<title>Internet and WWW How to Program - Welcome</title>
</head>
<body>
<p>Welcome to XHTML!</p>
</body>
</html>
XHTML Namespace (1/4)
<?xml version = "1.0"? encoding = “UTF-8”?>
<!DOCTYPE html PUBLIC "-//W3C//DTD XHTML 1.0
Transitional//EN" "http://www.w3.org/TR/xhtml1/DTD/xhtml1-
transitional.dtd">
<html xmlns = “http://www.w3.org/1999/xhtml”>
(Your XHTML page contents here)
</html>
Top-level declaration
Required to conform to XHTML syntax
XHTML Namespace (2/4)
<?xml version = "1.0"? encoding = “UTF-8”?>
<!DOCTYPE html PUBLIC "-//W3C//DTD XHTML 1.0 Transitional//EN"
"http://www.w3.org/TR/xhtml1/DTD/xhtml1-transitional.dtd">
<html xmlns = “http://www.w3.org/1999/xhtml”>
!DOCTYPE = specify what version of XHTML you’re using. It tells
browsers what type of information to expect in the page, which in turn,
tells it how to render the page.
It is also used by XHTML validators to verify syntax of the webpage
<?xml...> declaration = a processing instruction used to declare that this
document is an XML document which uses the UTF-8 (Unicode)
character encoding.
XHTML Namespace (3/4)
• <?xml version = "1.0"? encoding = “UTF-8”?>
• <!DOCTYPE html PUBLIC "-//W3C//DTD XHTML 1.0
Transitional//EN"
"http://www.w3.org/TR/xhtml1/DTD/xhtml1-
transitional.dtd">
•<html xmlns = “http://www.w3.org/1999/xhtml”>
the <html xmlns...> line opens the XHTML document
and declares the default namespace
XHTML Namespace (3/4)
So, what is an XHTML Namespace?
Briefly, namespaces are unique identifiers used in
XML to differentiate between different markup
languages. Each markup language, such as
XHTML, has a namespace (e.g.
http://www.w3.org/1999/xhtml)
XHTML Comments
• <!-- Fig. 4.1: main.html -->
• <!-- Our first Web page -->
Similar with HTML comments
XHTML Elements
Important elements of an XHTML document are
<html>
<head>
<body>
The html element encloses the head section and the body section
The head section contains information about the XHTML document
AND can also contain special document formatting instructions (style
sheets, scripts)
The body section contains the page’s content that the browser displays
XHTML Elements
Elements within an XHTML document have start and
end tags
<html> </html>
A start tag may have attribute with its value
<p class=“special”> </p>
An empty element contains only attributes and do not
markup text.
Validating an XHTML
document
W3C provides a validation service
(http://validator.w3.org) for checking the syntax
Other Elements
Header elements
<h1> to <h6>
Linking
<a href=“ “></a> OR <a href=“mailto: “></a>
Images
<img src=“ “/>
Special Characters (character entity references) and Line
Breaks
&lt; &gt; &amp;
<hr />, <br />
Other Elements (cont’d)
Lists (ordered and unordered)
<ol> </ol> and <ul> </ul>
<li> </li>
Image Maps
Framesets
Tables
XHTML Syntax Rules
Documents must be well-formed
Elements must nest symmetrically
Element names are case sensitive
End tags are required
Empty Elements are signified by a closing slash
Give space so older browsers will ignore the XHTML
closing slash e.g. <br />
Attribute values must be contained in Quotes
Why XHTML?
Cleaner code
XHTML requires us to remove code that does match
the standard such as deprecated elements
XHTML is based on XML so its capabilities can be
extended
Supports the variety of new devices & new technologies
used to access the Internet
Works smoothly with database and workflow applications
Style Sheets are Required
XHTML does not contain presentation information
The benefit of separating data from style
the same information can be directed to various
display devices simply by changing the style sheet
data-once, destination-many
The two style sheets languages that are available for
use with XML or XHTML: CSS and XSL
From HTML to XHTML
<H1>Some plain HTML
code</h1>
<P> This is a paragraph of
text.
<IMG SRC="xml.gif">
<H3>A bulleted list</H3>
<UL>
<LI>Item one
<LI>Item two
<LI>Item three
<h1>Some plain HTML code</h1>
<p>This is a paragraph of
text.</p>
<img src="xml.gif" />
<h3>A bulleted list</h3>
<ul>
<li>item one</li>
<li>item two</li>
<li>item three</li>
</ul>
Migrating from HTML to
XHTML
Evaluate existing code
Check for basic compliance with XHTML syntax
rules
Use HTML editing softwares to get this
automatically done
Evaluate existing presentation information
Are there deprecated tags e.g. <font> and
deprecated attributes e.g. “bgcolor”, “face” and
“size”?
Convert these to CSS
Migrating from HTML to
XHTML (cont’d)
Create coding conventions
To make sure that new coding and content added
will follow this standard
Start using CSS
Test for backward compatibility
XHTML Document Types
Strict
Clean, structural markup code. Free of any markup tags
associated with layout and from deprecated tags
Use CSS for styling
Transitional
Most common. Allows obsolete elements from older versions of
HTML and newer features such as style sheets and well-formed
markup.
Frameset
When using frames

More Related Content

PPT
4_Traditional html vs xhtml.ppt
PPT
PPTX
PPSX
PPT
xhtml_css.ppt
PPTX
Html vs xhtml
DOCX
What is html xml and xhtml
PPT
cis110-xml-xhtml engineering computer science
4_Traditional html vs xhtml.ppt
xhtml_css.ppt
Html vs xhtml
What is html xml and xhtml
cis110-xml-xhtml engineering computer science

Similar to Lecture07 ASDFASFA ASD ASD SDS XHTML.ppt (20)

PPTX
Lecture 4 - Adding XTHML for the Web
PPTX
HTML AND XML ppt.pptx
PDF
WT Module-1.pdf
KEY
HTML/CSS Lecture 1
PPS
DOCX
Xhtml
PDF
WEB Module 1.pdf
PPT
Wt-UNNIT-1 (1).ppt
DOCX
Summary of-xhtml-basics
PDF
xhtml-documentation
PDF
xhtml-documentation
PPTX
Xhtml and html5 basics
PPTX
IS221__Week1_Lecture chapter one, Web design.pptx
PDF
light_xml
PDF
3.web Technology and sub topics for computer applications
PPT
Intr to-html-xhtml-1233508169541646-3
PPTX
Html and Xhtml
PPSX
HTML & XHTML Basics
PPTX
BITM3730 10-18.pptx
Lecture 4 - Adding XTHML for the Web
HTML AND XML ppt.pptx
WT Module-1.pdf
HTML/CSS Lecture 1
Xhtml
WEB Module 1.pdf
Wt-UNNIT-1 (1).ppt
Summary of-xhtml-basics
xhtml-documentation
xhtml-documentation
Xhtml and html5 basics
IS221__Week1_Lecture chapter one, Web design.pptx
light_xml
3.web Technology and sub topics for computer applications
Intr to-html-xhtml-1233508169541646-3
Html and Xhtml
HTML & XHTML Basics
BITM3730 10-18.pptx
Ad

More from DrKBManwade (9)

PPT
daa_unit THIS IS GNDFJG SDGSGS SFDF .ppt
PPTX
50164-Artificial Intelligence PowerPoint.pptx
PPT
objectmodeling-121201024636-phpapp01.ppt
PPTX
Ch-1-Introduction to Computers.ppt.pptx
PDF
mecsch-sem3.pdf
PDF
eesch-sem3.pdf
PPT
E05WAREH1.PPT
PPTX
NITW_Improving Deep Neural Networks (1).pptx
PPTX
PICPP_M1_L2.pptx
daa_unit THIS IS GNDFJG SDGSGS SFDF .ppt
50164-Artificial Intelligence PowerPoint.pptx
objectmodeling-121201024636-phpapp01.ppt
Ch-1-Introduction to Computers.ppt.pptx
mecsch-sem3.pdf
eesch-sem3.pdf
E05WAREH1.PPT
NITW_Improving Deep Neural Networks (1).pptx
PICPP_M1_L2.pptx
Ad

Recently uploaded (20)

PPT
Environmental pollution for educational study
PPTX
Plant_Cell_Presentation.pptx.com learning purpose
PPTX
Biodiversity of nature in environmental studies.pptx
PDF
Effective factors on adoption of intercropping and it’s role on development o...
PPTX
"One Earth Celebrating World Environment Day"
PPTX
Disposal Of Wastes.pptx according to community medicine
PPT
PPTPresentation3 jhsvdasvdjhavsdhsvjcksjbc.jasb..ppt
PPTX
sustainable-development in tech-ppt[1].pptx
DOCX
D-360 ESG Series: Sustainable Hospitality Strategies for a Greener Future
PPTX
Concept of Safe and Wholesome Water.pptx
PDF
The Truth Behind Vantara zoo in Jamnagar
PPTX
Environmental Ethics: issues and possible solutions
DOCX
Epoxy Coated Steel Bolted Tanks for Agricultural Waste Biogas Digesters Turns...
PDF
Lecture 2 investigation of renal diseses.pdf
DOCX
Epoxy Coated Steel Bolted Tanks for Fish Farm Water Provides Reliable Water f...
PPTX
Green and Cream Aesthetic Group Project Presentation.pptx
PPTX
Conformity-and-Deviance module 7 ucsp grade 12
PPTX
Office Hours on Drivers of Tree Cover Loss
PDF
Insitu conservation seminar , national park ,enthobotanical significance
PPTX
NSTP1 NSTP1NSTP1NSTP1NSTP1NSTP1NSTP1NSTP
Environmental pollution for educational study
Plant_Cell_Presentation.pptx.com learning purpose
Biodiversity of nature in environmental studies.pptx
Effective factors on adoption of intercropping and it’s role on development o...
"One Earth Celebrating World Environment Day"
Disposal Of Wastes.pptx according to community medicine
PPTPresentation3 jhsvdasvdjhavsdhsvjcksjbc.jasb..ppt
sustainable-development in tech-ppt[1].pptx
D-360 ESG Series: Sustainable Hospitality Strategies for a Greener Future
Concept of Safe and Wholesome Water.pptx
The Truth Behind Vantara zoo in Jamnagar
Environmental Ethics: issues and possible solutions
Epoxy Coated Steel Bolted Tanks for Agricultural Waste Biogas Digesters Turns...
Lecture 2 investigation of renal diseses.pdf
Epoxy Coated Steel Bolted Tanks for Fish Farm Water Provides Reliable Water f...
Green and Cream Aesthetic Group Project Presentation.pptx
Conformity-and-Deviance module 7 ucsp grade 12
Office Hours on Drivers of Tree Cover Loss
Insitu conservation seminar , national park ,enthobotanical significance
NSTP1 NSTP1NSTP1NSTP1NSTP1NSTP1NSTP1NSTP

Lecture07 ASDFASFA ASD ASD SDS XHTML.ppt

  • 2. Introduction to XHTML Extensible HyperText Markup Language XHTML vs HTML XHTML: Separating structure and presentation (use CSS) A valid XHTML document allows only its content and structure HTML Can still contain formatting elements
  • 3. First XHTML Example <?xml version = "1.0"?> <!DOCTYPE html PUBLIC "-//W3C//DTD XHTML 1.0 Transitional//EN" "http://www.w3.org/TR/xhtml1/DTD/xhtml1-transitional.dtd"> <html xmlns = "http://www.w3.org/1999/xhtml"> <head> <title>Internet and WWW How to Program - Welcome</title> </head> <body> <p>Welcome to XHTML!</p> </body> </html>
  • 4. XHTML Namespace (1/4) <?xml version = "1.0"? encoding = “UTF-8”?> <!DOCTYPE html PUBLIC "-//W3C//DTD XHTML 1.0 Transitional//EN" "http://www.w3.org/TR/xhtml1/DTD/xhtml1- transitional.dtd"> <html xmlns = “http://www.w3.org/1999/xhtml”> (Your XHTML page contents here) </html> Top-level declaration Required to conform to XHTML syntax
  • 5. XHTML Namespace (2/4) <?xml version = "1.0"? encoding = “UTF-8”?> <!DOCTYPE html PUBLIC "-//W3C//DTD XHTML 1.0 Transitional//EN" "http://www.w3.org/TR/xhtml1/DTD/xhtml1-transitional.dtd"> <html xmlns = “http://www.w3.org/1999/xhtml”> !DOCTYPE = specify what version of XHTML you’re using. It tells browsers what type of information to expect in the page, which in turn, tells it how to render the page. It is also used by XHTML validators to verify syntax of the webpage <?xml...> declaration = a processing instruction used to declare that this document is an XML document which uses the UTF-8 (Unicode) character encoding.
  • 6. XHTML Namespace (3/4) • <?xml version = "1.0"? encoding = “UTF-8”?> • <!DOCTYPE html PUBLIC "-//W3C//DTD XHTML 1.0 Transitional//EN" "http://www.w3.org/TR/xhtml1/DTD/xhtml1- transitional.dtd"> •<html xmlns = “http://www.w3.org/1999/xhtml”> the <html xmlns...> line opens the XHTML document and declares the default namespace
  • 7. XHTML Namespace (3/4) So, what is an XHTML Namespace? Briefly, namespaces are unique identifiers used in XML to differentiate between different markup languages. Each markup language, such as XHTML, has a namespace (e.g. http://www.w3.org/1999/xhtml)
  • 8. XHTML Comments • <!-- Fig. 4.1: main.html --> • <!-- Our first Web page --> Similar with HTML comments
  • 9. XHTML Elements Important elements of an XHTML document are <html> <head> <body> The html element encloses the head section and the body section The head section contains information about the XHTML document AND can also contain special document formatting instructions (style sheets, scripts) The body section contains the page’s content that the browser displays
  • 10. XHTML Elements Elements within an XHTML document have start and end tags <html> </html> A start tag may have attribute with its value <p class=“special”> </p> An empty element contains only attributes and do not markup text.
  • 11. Validating an XHTML document W3C provides a validation service (http://validator.w3.org) for checking the syntax
  • 12. Other Elements Header elements <h1> to <h6> Linking <a href=“ “></a> OR <a href=“mailto: “></a> Images <img src=“ “/> Special Characters (character entity references) and Line Breaks &lt; &gt; &amp; <hr />, <br />
  • 13. Other Elements (cont’d) Lists (ordered and unordered) <ol> </ol> and <ul> </ul> <li> </li> Image Maps Framesets Tables
  • 14. XHTML Syntax Rules Documents must be well-formed Elements must nest symmetrically Element names are case sensitive End tags are required Empty Elements are signified by a closing slash Give space so older browsers will ignore the XHTML closing slash e.g. <br /> Attribute values must be contained in Quotes
  • 15. Why XHTML? Cleaner code XHTML requires us to remove code that does match the standard such as deprecated elements XHTML is based on XML so its capabilities can be extended Supports the variety of new devices & new technologies used to access the Internet Works smoothly with database and workflow applications
  • 16. Style Sheets are Required XHTML does not contain presentation information The benefit of separating data from style the same information can be directed to various display devices simply by changing the style sheet data-once, destination-many The two style sheets languages that are available for use with XML or XHTML: CSS and XSL
  • 17. From HTML to XHTML <H1>Some plain HTML code</h1> <P> This is a paragraph of text. <IMG SRC="xml.gif"> <H3>A bulleted list</H3> <UL> <LI>Item one <LI>Item two <LI>Item three <h1>Some plain HTML code</h1> <p>This is a paragraph of text.</p> <img src="xml.gif" /> <h3>A bulleted list</h3> <ul> <li>item one</li> <li>item two</li> <li>item three</li> </ul>
  • 18. Migrating from HTML to XHTML Evaluate existing code Check for basic compliance with XHTML syntax rules Use HTML editing softwares to get this automatically done Evaluate existing presentation information Are there deprecated tags e.g. <font> and deprecated attributes e.g. “bgcolor”, “face” and “size”? Convert these to CSS
  • 19. Migrating from HTML to XHTML (cont’d) Create coding conventions To make sure that new coding and content added will follow this standard Start using CSS Test for backward compatibility
  • 20. XHTML Document Types Strict Clean, structural markup code. Free of any markup tags associated with layout and from deprecated tags Use CSS for styling Transitional Most common. Allows obsolete elements from older versions of HTML and newer features such as style sheets and well-formed markup. Frameset When using frames

Editor's Notes

  • #6: source: www.webheadstart.org
  • #7: source: www.webheadstart.org
  • #8: source: www.webheadstart.org