SlideShare a Scribd company logo
4
Most read
5
Most read
15
Most read
HTML VS XHTML
24-09-2018
1
• Yastee A. Shah
By:
• Web Technology
Subject:
2
WHAT ARE MARKUP LANGUAGES?
• Markup languages are the foundation of the web-where it all started, when websites
were just static pages with text and a little formatting.
• Essentially, everything you see on the web is a combination of markup (text),
cascading style sheets or CSS (design), and front-end scripts (interactivity). That
markup, made possible by HTML, is what creates a site’s foundation.
24-09-2018
3
*https://html.com/
HTML
• HTML was the first Internet-based language developed strictly for the web.
Anything displayed in a browser is organized via HTML.
• Structure
24-09-2018
4
XHTML (eXtensible Hypertext Markup
Language)
• XHTML is essentially identical to HTML4 (the fourth iteration of HTML), but with
elements of XML that extend HTML’s capabilities.
24-09-2018
5
*https://developer.mozilla.org/en-US/docs/Learn/HTML
In summary…
• HTML came along first, XHTML was designed to fix problems with HTML.
• They’re all mark up languages that provide structure and organization to the
content of webpages and applications, but their relevance has shifted as newer
versions of HTML have evolved, rising to the challenges of mobile demands,
responsive design, and developers who want to accomplish more with less.
24-09-2018
6
The Most Important Differences from HTML:
Document Structure
• XHTML DOCTYPE is mandatory
• The xmls attribute in <html> is mandatory
• <html>, <head>, <title>, and <body>
are mandatory <!DOCTYPE html PUBLIC "-//W3C//DTD XHTML 1.0Transitional//EN"
"http://www.w3.org/TR/xhtml1/DTD/xhtml1-transitional.dtd">
<html xmlns="http://www.w3.org/1999/xhtml">
<head> <title>Title of document</title> </head>
<body>
some content
</body>
</html>
24-09-2018
7
XHTML Elements
• XHTML elements must be properly nested.
• XHTML elements must be always be closed
• XHTML elements must be in lowercase
• XHTML documents must have one root element
<html>
<head>
<title>This is bad HTML</title>
<body>
<h1>Bad HTML
<p>This is a paragraph
</body>
24-09-2018
8
XHTML Elements Must Always Be
Closed
This is wrong:
<p>This is a paragraph
<p>This is another paragraph
This is correct:
<p>This is a paragraph</p>
<p>This is another paragraph</p>
Empty Elements Must Also Be Closed
This is wrong:
A break: <br>
A horizontal rule: <hr>
An image: <img src="happy.gif" alt="Happy face">
This is correct:
A break: <br />
A horizontal rule: <hr />
An image: <img src="happy.gif" alt="Happy face" />
24-09-2018
9
XHTML Attributes
• Attribute names must be in lower case
• Attribute values must be quoted
• Attribute minimization is forbidden
24-09-2018
10
*http://www.htmldog.com/guides/
XHTML Attribute Names Must Be In Lower Case
This is wrong:
<table WIDTH="100%">
Attribute Values Must Be Quoted
This is wrong:
<table width=100%>
XHTML Elements Must Be In Lower Case
This is wrong:
<BODY>
<P>This is a paragraph</P>
</BODY>
This is correct:
<table width="100%">
This is correct:
<table width="100%">
This is correct:
<body>
<p>This is a paragraph</p>
</body>
24-09-2018
11
• Attribute Minimization Is Forbidden
Wrong:
<input type="checkbox" name="vehicle" value="car" checked />
Correct:
<input type="checkbox" name="vehicle" value="car" checked="checked"/>
Wrong:
<input type="text" name="lastname" disabled />
Correct:
<input type="text" name="lastname" disabled="disabled" />
24-09-2018
12
HTML vs. XHTML
24-09-2018
13
*https://www.edx.org/course/introduction-to-html-and-
javascript
HTML XHTML
Introduction Main markup language for creating web
pages and other information that can be
displayed in a web browser.
Family of XML markup languages that
extend versions of HTML.
Filename extension .html, .htm .xhtml, .xht, .xml, .html, .htm
Internet media type text/html application/xhtml+xml
Type of format Document file format Markup language
Stands for HyperText Markup Language Extensible HyperText Markup Language
14
HTML XHTML
Application Application of Standard Generalized Markup Language
(SGML).
Application ofXML
Function
Web pages are written in HTML. Extended version of HTML that is stricter
and XML-based.
Nature
Flexible framework requiring purely HTML specific.
Restrictive subset of XML and needs to be
parsed with standard XML parsers.
Origin Proposed byTim Berners-Lee in 1987. WorldWideWeb Consortium
Recommendation in 2000.
Versions HTML 2, HTML 3.2, HTML 4.0, HTML 5. XHTML 1, XHTML 1.1, XHTML 2, XHTML 5.15
Features of HTML vs XHTML documents
• HTML documents are composed of elements that have three components-
1. start tag
2.end tag; element attributes given within tags and actual, textual and graphic
content
3.including tags. (Tag is a keyword which is enclosed within angle brackets).
• XHTML documents has only one root element.
• All elements including variables must be in lower case, and values assigned
must be surrounded by quotes, closed and nested for being recognized.
24-09-2018
16
*https://www.codecademy.com/learn/learn-html
• The declaration of DOCTYPE would determine rules for documents to follow.
• The underlying syntax of HTML allows many shortcuts that XHTML does not, such as
elements with optional opening or closing tags, and even EMPTY elements which must
not have an end tag.
• XHTML requires all elements to have an opening tag or a closing tag. XHTML, however,
also introduces a new shortcut: an XHTML
• Tag may be opened and closed within the same tag, by including a slash before the end
of the tag like this: <br/>. A fix for this is to include a space before closing the tag, as
such: <br />.
24-09-2018
17
How to Convert from HTML to XHTML
• Add an XHTML <!DOCTYPE> to the first line of every page
• Add an xmlns attribute to the html element of every page
• Include xml:lang and lang attributes on elements assigning language.
• Change all element and attribute names to lowercase
• Close all empty elements
• Include close tags for elements that can have content but are empty: <html></html>
• Include an extra space in empty-element tags: <html />
• Quote all attribute values
• Do not include XML declaration.
24-09-2018
18
24-09-2018
19
It is actually pretty easy. You just have to:
•Change your DOCTYPE
•Change Some Meta Tags
•Close all your tags properly
•Surround inline tags with block tags
•Eliminate the use of a few tags
•Leave the styling to Cascading Style Sheets
How to migrate from XHTML to HTML
• The language for an element should be specified with a lang attribute rather than the
XHTML xml:lang attribute.
• Remove the XML namespace (xmlns=URI). HTML has no facilities for namespaces.
• Change the document type declaration from XHTML to HTML.
• If present, remove the XML declaration. (Typically this is: <?xml version="1.0"?>).
• Change the XML empty-element syntax to an HTML style empty element (<br/> to
<br>).
24-09-2018
20
21
24-09-2018

More Related Content

What's hot (20)

PDF
Html frames
eShikshak
 
PDF
Introduction to HTML5
Gil Fink
 
PPTX
Html forms
Himanshu Pathak
 
PPTX
Html links
JayjZens
 
PDF
Lecture-1: Introduction to web engineering - course overview and grading scheme
Mubashir Ali
 
PPTX
Css types internal, external and inline (1)
Webtech Learning
 
PPTX
HTML frames and HTML forms
Nadine Cruz
 
PPTX
Introduction to php
Taha Malampatti
 
PDF
JavaScript - Chapter 13 - Browser Object Model(BOM)
WebStackAcademy
 
PPT
Introduction to CSS
Amit Tyagi
 
PPTX
Web Application
Sameer Poudel
 
ODP
Introduction of Html/css/js
Knoldus Inc.
 
PPTX
HTML Text formatting tags
Himanshu Pathak
 
PPTX
Css
Hemant Saini
 
PPT
JQuery introduction
NexThoughts Technologies
 
PPTX
PHP array 1
Mudasir Syed
 
PPT
Introduction to Java Programming, Basic Structure, variables Data type, input...
Mr. Akaash
 
PDF
HTML CSS Basics
Mai Moustafa
 
PPT
Introduction to html
vikasgaur31
 
Html frames
eShikshak
 
Introduction to HTML5
Gil Fink
 
Html forms
Himanshu Pathak
 
Html links
JayjZens
 
Lecture-1: Introduction to web engineering - course overview and grading scheme
Mubashir Ali
 
Css types internal, external and inline (1)
Webtech Learning
 
HTML frames and HTML forms
Nadine Cruz
 
Introduction to php
Taha Malampatti
 
JavaScript - Chapter 13 - Browser Object Model(BOM)
WebStackAcademy
 
Introduction to CSS
Amit Tyagi
 
Web Application
Sameer Poudel
 
Introduction of Html/css/js
Knoldus Inc.
 
HTML Text formatting tags
Himanshu Pathak
 
JQuery introduction
NexThoughts Technologies
 
PHP array 1
Mudasir Syed
 
Introduction to Java Programming, Basic Structure, variables Data type, input...
Mr. Akaash
 
HTML CSS Basics
Mai Moustafa
 
Introduction to html
vikasgaur31
 

Similar to Html vs xhtml (20)

PDF
WT Module-1.pdf
RamyaH11
 
PPTX
Html5
Shiva RamDam
 
PPTX
IS221__Week1_Lecture chapter one, Web design.pptx
kumaranikethnavish
 
PPTX
9781285852645_CH01 research and analysis of data.pptx
clement swarnappa
 
PPT
Introduction to html
Jonathan Arroyo
 
PPT
4_Traditional html vs xhtml.ppt
VARNITBHASKAR1
 
PPTX
Introduction to html course digital markerters
SEO SKills
 
PPTX
Web design - HTML (Hypertext Markup Language) introduction
Mustafa Kamel Mohammadi
 
PPTX
Introduction to HTML.pptx
VaibhavSingh887876
 
DOCX
Summary of-xhtml-basics
starlanter
 
PPT
1. html introduction
Muhammad Toqeer
 
PPTX
Lecture 2 introduction to html basics
AliMUSSA3
 
PPT
HTML & CSS.ppt
vaseemshaik21
 
PPT
Html basics
mcatahir947
 
PPT
html and css- 23091 3154 458-5d4341a0.ppt
ahoveida
 
PPT
Html presentation
Amber Bhaumik
 
PPTX
Html.pptx
SuhaibKhan62
 
PPTX
2. HTML Basic unit2 fundamentals of computer
travelwithlifezindgi
 
PPTX
Html (hypertext markup language)
Resty Jay Galdo
 
PPTX
Presentation html
Billy Tierra
 
WT Module-1.pdf
RamyaH11
 
Html5
Shiva RamDam
 
IS221__Week1_Lecture chapter one, Web design.pptx
kumaranikethnavish
 
9781285852645_CH01 research and analysis of data.pptx
clement swarnappa
 
Introduction to html
Jonathan Arroyo
 
4_Traditional html vs xhtml.ppt
VARNITBHASKAR1
 
Introduction to html course digital markerters
SEO SKills
 
Web design - HTML (Hypertext Markup Language) introduction
Mustafa Kamel Mohammadi
 
Introduction to HTML.pptx
VaibhavSingh887876
 
Summary of-xhtml-basics
starlanter
 
1. html introduction
Muhammad Toqeer
 
Lecture 2 introduction to html basics
AliMUSSA3
 
HTML & CSS.ppt
vaseemshaik21
 
Html basics
mcatahir947
 
html and css- 23091 3154 458-5d4341a0.ppt
ahoveida
 
Html presentation
Amber Bhaumik
 
Html.pptx
SuhaibKhan62
 
2. HTML Basic unit2 fundamentals of computer
travelwithlifezindgi
 
Html (hypertext markup language)
Resty Jay Galdo
 
Presentation html
Billy Tierra
 
Ad

More from Yastee Shah (11)

PPTX
AWT.pptx
Yastee Shah
 
PPTX
jdbc vs hibernate.pptx
Yastee Shah
 
PPTX
FIND MINIMUM TIME TO FINISH ALL JOBS WITH GIVEN CONSTRAINTS.pptx
Yastee Shah
 
PPTX
Application of Queue.pptx
Yastee Shah
 
PPTX
Edison's work habits and thinking about failure.pptx
Yastee Shah
 
PPTX
Smart grid.pptx
Yastee Shah
 
PPTX
Raid
Yastee Shah
 
PPTX
Water Level Indicator
Yastee Shah
 
PPTX
Types of virus and saviour
Yastee Shah
 
PPTX
Output devices
Yastee Shah
 
PPTX
Math
Yastee Shah
 
AWT.pptx
Yastee Shah
 
jdbc vs hibernate.pptx
Yastee Shah
 
FIND MINIMUM TIME TO FINISH ALL JOBS WITH GIVEN CONSTRAINTS.pptx
Yastee Shah
 
Application of Queue.pptx
Yastee Shah
 
Edison's work habits and thinking about failure.pptx
Yastee Shah
 
Smart grid.pptx
Yastee Shah
 
Water Level Indicator
Yastee Shah
 
Types of virus and saviour
Yastee Shah
 
Output devices
Yastee Shah
 
Ad

Recently uploaded (20)

PPTX
Light weight Concrete-CONCRETE TECHNOLOGY.
mayurbhandari2123
 
PDF
tdtr.pdfjjjjjjjjjjjjjjjjjjjjjjjjjjjjjjjjj
JuanCParedes
 
DOCX
CERT HERNANDEZ CHURCH PHILIPPIBNES .docx
michael patino
 
PPTX
Transportation in the air, sea and land.pptx
KhloodAli5
 
PDF
WEEK3-Literary-Gennnnnnnnnnnnnnnnnres.pdf
MaybelynVergara
 
PPTX
High-Rise Interior Mastery by Top 3D Visualization Experts
Yantram Animation Studio Corporation
 
PDF
CRAC- Adobe Photoshop CC 2016 (32 64Bit) Crack
utfefguu
 
PDF
S2 Associates brings museum exhibits to life with innovative design.pdf
S2 Associates
 
PDF
Presentation - Interior Design Concepts (2).pdf
vrindagrawal456
 
PPTX
HIGH DENSITY CONCRETE-Concrete Technology
mayurbhandari2123
 
PDF
Case Study on good and bad acoustics in auditorium
Disha Agrawal
 
PDF
Uber Driver Hackday Sprint Solving Ride Cancellations
YellowSlice1
 
PDF
SS27 Men's Fashion Trend Book Peclers Paris
Peclers Paris
 
PPTX
Dndnnnssjsjjsjsjjsssjsjsjjsjsjsjsjjsjsjdn.pptx
Nandy31
 
PPTX
SAMPLE FILE OF-PPT-FINAL-ORAL-DEFENSE.pptx
Yvez2
 
PPTX
(2) Cell Wall Inhibitors_Cephalosporins others.pptx
mkurdi133
 
PPTX
Town planning is a concept used in architectural design. It plays a very impo...
IshikaPanchal11
 
DOCX
Redefining Master Plans for creating sustainable cities-Jharkhand Conference...
JIT KUMAR GUPTA
 
PPTX
CompanyReviewTypeOfPowerpointThatIsColor
plukleomarigpuara
 
PDF
ARC-101-B-4.pdfxxxxxxxxxxxxxxxxxxxxxxxxx
IzzyBaniquedBusto
 
Light weight Concrete-CONCRETE TECHNOLOGY.
mayurbhandari2123
 
tdtr.pdfjjjjjjjjjjjjjjjjjjjjjjjjjjjjjjjjj
JuanCParedes
 
CERT HERNANDEZ CHURCH PHILIPPIBNES .docx
michael patino
 
Transportation in the air, sea and land.pptx
KhloodAli5
 
WEEK3-Literary-Gennnnnnnnnnnnnnnnnres.pdf
MaybelynVergara
 
High-Rise Interior Mastery by Top 3D Visualization Experts
Yantram Animation Studio Corporation
 
CRAC- Adobe Photoshop CC 2016 (32 64Bit) Crack
utfefguu
 
S2 Associates brings museum exhibits to life with innovative design.pdf
S2 Associates
 
Presentation - Interior Design Concepts (2).pdf
vrindagrawal456
 
HIGH DENSITY CONCRETE-Concrete Technology
mayurbhandari2123
 
Case Study on good and bad acoustics in auditorium
Disha Agrawal
 
Uber Driver Hackday Sprint Solving Ride Cancellations
YellowSlice1
 
SS27 Men's Fashion Trend Book Peclers Paris
Peclers Paris
 
Dndnnnssjsjjsjsjjsssjsjsjjsjsjsjsjjsjsjdn.pptx
Nandy31
 
SAMPLE FILE OF-PPT-FINAL-ORAL-DEFENSE.pptx
Yvez2
 
(2) Cell Wall Inhibitors_Cephalosporins others.pptx
mkurdi133
 
Town planning is a concept used in architectural design. It plays a very impo...
IshikaPanchal11
 
Redefining Master Plans for creating sustainable cities-Jharkhand Conference...
JIT KUMAR GUPTA
 
CompanyReviewTypeOfPowerpointThatIsColor
plukleomarigpuara
 
ARC-101-B-4.pdfxxxxxxxxxxxxxxxxxxxxxxxxx
IzzyBaniquedBusto
 

Html vs xhtml

  • 1. HTML VS XHTML 24-09-2018 1 • Yastee A. Shah By: • Web Technology Subject:
  • 2. 2
  • 3. WHAT ARE MARKUP LANGUAGES? • Markup languages are the foundation of the web-where it all started, when websites were just static pages with text and a little formatting. • Essentially, everything you see on the web is a combination of markup (text), cascading style sheets or CSS (design), and front-end scripts (interactivity). That markup, made possible by HTML, is what creates a site’s foundation. 24-09-2018 3 *https://html.com/
  • 4. HTML • HTML was the first Internet-based language developed strictly for the web. Anything displayed in a browser is organized via HTML. • Structure 24-09-2018 4
  • 5. XHTML (eXtensible Hypertext Markup Language) • XHTML is essentially identical to HTML4 (the fourth iteration of HTML), but with elements of XML that extend HTML’s capabilities. 24-09-2018 5 *https://developer.mozilla.org/en-US/docs/Learn/HTML
  • 6. In summary… • HTML came along first, XHTML was designed to fix problems with HTML. • They’re all mark up languages that provide structure and organization to the content of webpages and applications, but their relevance has shifted as newer versions of HTML have evolved, rising to the challenges of mobile demands, responsive design, and developers who want to accomplish more with less. 24-09-2018 6
  • 7. The Most Important Differences from HTML: Document Structure • XHTML DOCTYPE is mandatory • The xmls attribute in <html> is mandatory • <html>, <head>, <title>, and <body> are mandatory <!DOCTYPE html PUBLIC "-//W3C//DTD XHTML 1.0Transitional//EN" "http://www.w3.org/TR/xhtml1/DTD/xhtml1-transitional.dtd"> <html xmlns="http://www.w3.org/1999/xhtml"> <head> <title>Title of document</title> </head> <body> some content </body> </html> 24-09-2018 7
  • 8. XHTML Elements • XHTML elements must be properly nested. • XHTML elements must be always be closed • XHTML elements must be in lowercase • XHTML documents must have one root element <html> <head> <title>This is bad HTML</title> <body> <h1>Bad HTML <p>This is a paragraph </body> 24-09-2018 8
  • 9. XHTML Elements Must Always Be Closed This is wrong: <p>This is a paragraph <p>This is another paragraph This is correct: <p>This is a paragraph</p> <p>This is another paragraph</p> Empty Elements Must Also Be Closed This is wrong: A break: <br> A horizontal rule: <hr> An image: <img src="happy.gif" alt="Happy face"> This is correct: A break: <br /> A horizontal rule: <hr /> An image: <img src="happy.gif" alt="Happy face" /> 24-09-2018 9
  • 10. XHTML Attributes • Attribute names must be in lower case • Attribute values must be quoted • Attribute minimization is forbidden 24-09-2018 10 *http://www.htmldog.com/guides/
  • 11. XHTML Attribute Names Must Be In Lower Case This is wrong: <table WIDTH="100%"> Attribute Values Must Be Quoted This is wrong: <table width=100%> XHTML Elements Must Be In Lower Case This is wrong: <BODY> <P>This is a paragraph</P> </BODY> This is correct: <table width="100%"> This is correct: <table width="100%"> This is correct: <body> <p>This is a paragraph</p> </body> 24-09-2018 11
  • 12. • Attribute Minimization Is Forbidden Wrong: <input type="checkbox" name="vehicle" value="car" checked /> Correct: <input type="checkbox" name="vehicle" value="car" checked="checked"/> Wrong: <input type="text" name="lastname" disabled /> Correct: <input type="text" name="lastname" disabled="disabled" /> 24-09-2018 12
  • 14. HTML XHTML Introduction Main markup language for creating web pages and other information that can be displayed in a web browser. Family of XML markup languages that extend versions of HTML. Filename extension .html, .htm .xhtml, .xht, .xml, .html, .htm Internet media type text/html application/xhtml+xml Type of format Document file format Markup language Stands for HyperText Markup Language Extensible HyperText Markup Language 14
  • 15. HTML XHTML Application Application of Standard Generalized Markup Language (SGML). Application ofXML Function Web pages are written in HTML. Extended version of HTML that is stricter and XML-based. Nature Flexible framework requiring purely HTML specific. Restrictive subset of XML and needs to be parsed with standard XML parsers. Origin Proposed byTim Berners-Lee in 1987. WorldWideWeb Consortium Recommendation in 2000. Versions HTML 2, HTML 3.2, HTML 4.0, HTML 5. XHTML 1, XHTML 1.1, XHTML 2, XHTML 5.15
  • 16. Features of HTML vs XHTML documents • HTML documents are composed of elements that have three components- 1. start tag 2.end tag; element attributes given within tags and actual, textual and graphic content 3.including tags. (Tag is a keyword which is enclosed within angle brackets). • XHTML documents has only one root element. • All elements including variables must be in lower case, and values assigned must be surrounded by quotes, closed and nested for being recognized. 24-09-2018 16 *https://www.codecademy.com/learn/learn-html
  • 17. • The declaration of DOCTYPE would determine rules for documents to follow. • The underlying syntax of HTML allows many shortcuts that XHTML does not, such as elements with optional opening or closing tags, and even EMPTY elements which must not have an end tag. • XHTML requires all elements to have an opening tag or a closing tag. XHTML, however, also introduces a new shortcut: an XHTML • Tag may be opened and closed within the same tag, by including a slash before the end of the tag like this: <br/>. A fix for this is to include a space before closing the tag, as such: <br />. 24-09-2018 17
  • 18. How to Convert from HTML to XHTML • Add an XHTML <!DOCTYPE> to the first line of every page • Add an xmlns attribute to the html element of every page • Include xml:lang and lang attributes on elements assigning language. • Change all element and attribute names to lowercase • Close all empty elements • Include close tags for elements that can have content but are empty: <html></html> • Include an extra space in empty-element tags: <html /> • Quote all attribute values • Do not include XML declaration. 24-09-2018 18
  • 19. 24-09-2018 19 It is actually pretty easy. You just have to: •Change your DOCTYPE •Change Some Meta Tags •Close all your tags properly •Surround inline tags with block tags •Eliminate the use of a few tags •Leave the styling to Cascading Style Sheets
  • 20. How to migrate from XHTML to HTML • The language for an element should be specified with a lang attribute rather than the XHTML xml:lang attribute. • Remove the XML namespace (xmlns=URI). HTML has no facilities for namespaces. • Change the document type declaration from XHTML to HTML. • If present, remove the XML declaration. (Typically this is: <?xml version="1.0"?>). • Change the XML empty-element syntax to an HTML style empty element (<br/> to <br>). 24-09-2018 20