SlideShare ist ein Scribd-Unternehmen logo
1 von 25
Introduction to XHTML
• XHTML stands for EXtensible Hyper
Text 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.
Why XHTML?
• Many pages on the internet contain "bad" HTML.
• code will work fine if you view it in a browser (even
if it does NOT follow the HTML rules):

<html>
<head>
<title>This is bad HTML</title>
<body>
<h1>Bad HTML
<p>This is a paragraph
</body>
• Today's market consists of different browser
technologies. Some browsers run on computers, and
some browsers run on mobile phones or other small
devices.

• Smaller devices often lack the resources or power to
interpret a "bad" markup language.
Difference between HTML
&XHTML
• Document Structure
• XHTML DOCTYPE is mandatory
• The XML namespace attribute in <html> is mandatory
• <html>, <head>, <title>, and <body> is mandatory
• XHTML Elements
• XHTML elements must be properly nested
• XHTML elements must always be closed
• XHTML elements must be in lowercase
• XHTML documents must have one root element
• XHTML Attributes
• Attribute names must be in lower case
• Attribute values must be quoted
• Attribute minimization is forbidden
• XHTML Elements Must Be Properly Nested
wrong
<b><i>This text is bold and italic</b></i>
correct
<b><i>This text is bold and italic</i></b>
• XHTML Elements Must Always Be Closed
Wrong
<p>This is a paragraph
<p>This is another paragraph
correct
<p>This is a paragraph</p>
<p>This is another paragraph</p>
• Empty Elements Must Also Be Closed
Wrong
A break: <br>
A horizontal rule: <hr>
An image: <img src="happy.gif" alt="Happy face">
correct
A break: <br />
A horizontal rule: <hr />
An image: <img src="happy.gif" alt="Happy face" />
• XHTML Elements Must Be In Lower Case
wrong:
<BODY>
<P>This is a paragraph</P>
</BODY>
correct:
<body>
<p>This is a paragraph</p>
</body>
• Attribute Names Must Be In Lower Case
wrong:
<table WIDTH="100%">

correct:
<table width="100%">
• Attribute Values Must Be Quoted
wrong:
<table width=100%>

Correct
<table width="100%">
• Attribute Minimization Is Forbidden
Wrong
<input checked>
<input readonly>
Correct
<input checked="checked">
<input readonly="readonly">
<meta> Tag
Meta information – information about information
 Provides useful information about the content of your
Web site

META tag is primarily used to help search engines

better index a document by supplying additional
information about the document.
META tags includes an author's name, a description
or short abstract of a document, or a set of
keywords for indexing a document.
• Providing this type of information will increase the
chance that users will find your documents -- the
information they want -- on the Web.

• In addition to providing indexing information,
META tags can also be used to refresh a Web page.
• <meta> tags always goes inside the <head> element
• It has a start tag but does not have a corresponding
end tag

• more than one META tag can be used within a
document
META Tag Attributes
Attribute
Name or
http-equiv

content

Value
Keywords
Description
author
text

Description
Specifies a name for the
metadata

Gives the value associated
with the http-equiv or
name attribute
• Define keywords for search engines:
<meta name="keywords" content="HTML, CSS,
XML, XHTML, JavaScript">

• Define a description of your web page:
<meta name="description" content="Free Web
tutorials on HTML and CSS">
• Define the author of a page:
<meta name="author" content="Hege Refsnes">

• Refresh document every 30 seconds:
<meta http-equiv="refresh" content="30">
Character entities
• Reserved characters in HTML must be replaced with
character entities.

• It is not possible to use the less than (<) or greater
than (>) signs in your text, because the browser will
mix them with tags.

• To actually display reserved characters, we must use
character entities in the HTML source code.
• Example
<html>
<head>
<title>meta tag</title>

<meta name="keywords" content="HTML, CSS, XML,
XHTML, JavaScript">
</head>
</html>
• A character entity looks like this:
• &entity_name;
OR

• &#entity_number;
Useful Character Entities
Result

Description

Entity Name

Entity
Number(ASCII
Value)

Non-breaking space

&nbsp;

&#160;

<

less than

&lt;

&#60;

>

greater than

&gt;

&#62;

&

ampersand

&amp;

&#38;

©

copyright

&copy;

&#169;

®

registered trademark

&reg;

&#174;

™

trademark

&trade;

&#8482;
Effect of Using Character Entities
and ASCII Values

&quot;Success is counted sweetest….

Copyright &#169; 2004. Kelly Valqui.
Copyright (c) 2004 Prentice-Hall. All rights reserved.

25

Weitere ähnliche Inhalte

Was ist angesagt?

Was ist angesagt? (20)

JavaScript - Chapter 8 - Objects
 JavaScript - Chapter 8 - Objects JavaScript - Chapter 8 - Objects
JavaScript - Chapter 8 - Objects
 
Html / CSS Presentation
Html / CSS PresentationHtml / CSS Presentation
Html / CSS Presentation
 
Cascading style sheets (CSS)
Cascading style sheets (CSS)Cascading style sheets (CSS)
Cascading style sheets (CSS)
 
Html and css
Html and cssHtml and css
Html and css
 
CSS
CSSCSS
CSS
 
HTML Forms
HTML FormsHTML Forms
HTML Forms
 
Css
CssCss
Css
 
Css
CssCss
Css
 
javaScript.ppt
javaScript.pptjavaScript.ppt
javaScript.ppt
 
Introduction of Html/css/js
Introduction of Html/css/jsIntroduction of Html/css/js
Introduction of Html/css/js
 
Basic-CSS-tutorial
Basic-CSS-tutorialBasic-CSS-tutorial
Basic-CSS-tutorial
 
Html form tag
Html form tagHtml form tag
Html form tag
 
Cookies and sessions
Cookies and sessionsCookies and sessions
Cookies and sessions
 
Xml schema
Xml schemaXml schema
Xml schema
 
Introduction to HTML5
Introduction to HTML5Introduction to HTML5
Introduction to HTML5
 
Xml namespace
Xml namespaceXml namespace
Xml namespace
 
Css pseudo-classes
Css pseudo-classesCss pseudo-classes
Css pseudo-classes
 
Jsp ppt
Jsp pptJsp ppt
Jsp ppt
 
Javascript
JavascriptJavascript
Javascript
 
Javascript basics
Javascript basicsJavascript basics
Javascript basics
 

Andere mochten auch (14)

3 hr interval training
3 hr interval training3 hr interval training
3 hr interval training
 
Voila le diapo d'Elise.
Voila le diapo d'Elise.Voila le diapo d'Elise.
Voila le diapo d'Elise.
 
Sist. endocrino UAN
Sist. endocrino UAN Sist. endocrino UAN
Sist. endocrino UAN
 
Rufisque en féte
Rufisque en féteRufisque en féte
Rufisque en féte
 
El comic.
El comic.El comic.
El comic.
 
Presentacion landmasters class= (1)
Presentacion landmasters class= (1)Presentacion landmasters class= (1)
Presentacion landmasters class= (1)
 
Teaching Approaches
Teaching Approaches Teaching Approaches
Teaching Approaches
 
Website design principles
Website design principlesWebsite design principles
Website design principles
 
María valberg
María valbergMaría valberg
María valberg
 
Javascript regular expression
Javascript regular expressionJavascript regular expression
Javascript regular expression
 
#MOOCUTPL #AplicandoGamificacion Juguetería
#MOOCUTPL #AplicandoGamificacion Juguetería#MOOCUTPL #AplicandoGamificacion Juguetería
#MOOCUTPL #AplicandoGamificacion Juguetería
 
Las TICs en la Educacion e Industria
Las TICs en la Educacion e IndustriaLas TICs en la Educacion e Industria
Las TICs en la Educacion e Industria
 
Midterm Sociology Study Guide
Midterm Sociology Study GuideMidterm Sociology Study Guide
Midterm Sociology Study Guide
 
Velocidad de desplazamiento
Velocidad de desplazamientoVelocidad de desplazamiento
Velocidad de desplazamiento
 

Ähnlich wie Introduction to xhtml

Ähnlich wie Introduction to xhtml (20)

Xhtml
XhtmlXhtml
Xhtml
 
Xhtml
XhtmlXhtml
Xhtml
 
Html Workshop
Html WorkshopHtml Workshop
Html Workshop
 
Summary of-xhtml-basics
Summary of-xhtml-basicsSummary of-xhtml-basics
Summary of-xhtml-basics
 
html
htmlhtml
html
 
HTML_css_web__tech___nology_______________.pptx
HTML_css_web__tech___nology_______________.pptxHTML_css_web__tech___nology_______________.pptx
HTML_css_web__tech___nology_______________.pptx
 
Lab1_HTML.pptx
Lab1_HTML.pptxLab1_HTML.pptx
Lab1_HTML.pptx
 
CSS tutorial chapter 3
CSS tutorial chapter 3CSS tutorial chapter 3
CSS tutorial chapter 3
 
What is HTML - An Introduction to HTML (Hypertext Markup Language)
What is HTML - An Introduction to HTML (Hypertext Markup Language)What is HTML - An Introduction to HTML (Hypertext Markup Language)
What is HTML - An Introduction to HTML (Hypertext Markup Language)
 
HTML tutorial chapter 1
HTML tutorial chapter 1HTML tutorial chapter 1
HTML tutorial chapter 1
 
HTML 5 Basics Part One
HTML 5 Basics Part OneHTML 5 Basics Part One
HTML 5 Basics Part One
 
Html ppt by Fathima faculty Hasanath college for women bangalore
Html ppt by Fathima faculty Hasanath college for women bangaloreHtml ppt by Fathima faculty Hasanath college for women bangalore
Html ppt by Fathima faculty Hasanath college for women bangalore
 
Web forms and html (lect 1)
Web forms and html (lect 1)Web forms and html (lect 1)
Web forms and html (lect 1)
 
Web technologies-course 02.pptx
Web technologies-course 02.pptxWeb technologies-course 02.pptx
Web technologies-course 02.pptx
 
Html intro
Html introHtml intro
Html intro
 
Computer application html
Computer application htmlComputer application html
Computer application html
 
HTML? What is Hyper Text Mark Up Language
HTML? What is Hyper Text Mark Up  LanguageHTML? What is Hyper Text Mark Up  Language
HTML? What is Hyper Text Mark Up Language
 
Basic Html Knowledge for students
Basic Html Knowledge for studentsBasic Html Knowledge for students
Basic Html Knowledge for students
 
BITM3730Week3.pptx
BITM3730Week3.pptxBITM3730Week3.pptx
BITM3730Week3.pptx
 
Html basics
Html basicsHtml basics
Html basics
 

Kürzlich hochgeladen

Salient Features of India constitution especially power and functions
Salient Features of India constitution especially power and functionsSalient Features of India constitution especially power and functions
Salient Features of India constitution especially power and functions
KarakKing
 

Kürzlich hochgeladen (20)

TỔNG ÔN TẬP THI VÀO LỚP 10 MÔN TIẾNG ANH NĂM HỌC 2023 - 2024 CÓ ĐÁP ÁN (NGỮ Â...
TỔNG ÔN TẬP THI VÀO LỚP 10 MÔN TIẾNG ANH NĂM HỌC 2023 - 2024 CÓ ĐÁP ÁN (NGỮ Â...TỔNG ÔN TẬP THI VÀO LỚP 10 MÔN TIẾNG ANH NĂM HỌC 2023 - 2024 CÓ ĐÁP ÁN (NGỮ Â...
TỔNG ÔN TẬP THI VÀO LỚP 10 MÔN TIẾNG ANH NĂM HỌC 2023 - 2024 CÓ ĐÁP ÁN (NGỮ Â...
 
Micro-Scholarship, What it is, How can it help me.pdf
Micro-Scholarship, What it is, How can it help me.pdfMicro-Scholarship, What it is, How can it help me.pdf
Micro-Scholarship, What it is, How can it help me.pdf
 
How to setup Pycharm environment for Odoo 17.pptx
How to setup Pycharm environment for Odoo 17.pptxHow to setup Pycharm environment for Odoo 17.pptx
How to setup Pycharm environment for Odoo 17.pptx
 
Sensory_Experience_and_Emotional_Resonance_in_Gabriel_Okaras_The_Piano_and_Th...
Sensory_Experience_and_Emotional_Resonance_in_Gabriel_Okaras_The_Piano_and_Th...Sensory_Experience_and_Emotional_Resonance_in_Gabriel_Okaras_The_Piano_and_Th...
Sensory_Experience_and_Emotional_Resonance_in_Gabriel_Okaras_The_Piano_and_Th...
 
2024-NATIONAL-LEARNING-CAMP-AND-OTHER.pptx
2024-NATIONAL-LEARNING-CAMP-AND-OTHER.pptx2024-NATIONAL-LEARNING-CAMP-AND-OTHER.pptx
2024-NATIONAL-LEARNING-CAMP-AND-OTHER.pptx
 
Sociology 101 Demonstration of Learning Exhibit
Sociology 101 Demonstration of Learning ExhibitSociology 101 Demonstration of Learning Exhibit
Sociology 101 Demonstration of Learning Exhibit
 
Accessible Digital Futures project (20/03/2024)
Accessible Digital Futures project (20/03/2024)Accessible Digital Futures project (20/03/2024)
Accessible Digital Futures project (20/03/2024)
 
How to Give a Domain for a Field in Odoo 17
How to Give a Domain for a Field in Odoo 17How to Give a Domain for a Field in Odoo 17
How to Give a Domain for a Field in Odoo 17
 
Mehran University Newsletter Vol-X, Issue-I, 2024
Mehran University Newsletter Vol-X, Issue-I, 2024Mehran University Newsletter Vol-X, Issue-I, 2024
Mehran University Newsletter Vol-X, Issue-I, 2024
 
ICT role in 21st century education and it's challenges.
ICT role in 21st century education and it's challenges.ICT role in 21st century education and it's challenges.
ICT role in 21st century education and it's challenges.
 
Spatium Project Simulation student brief
Spatium Project Simulation student briefSpatium Project Simulation student brief
Spatium Project Simulation student brief
 
Salient Features of India constitution especially power and functions
Salient Features of India constitution especially power and functionsSalient Features of India constitution especially power and functions
Salient Features of India constitution especially power and functions
 
Key note speaker Neum_Admir Softic_ENG.pdf
Key note speaker Neum_Admir Softic_ENG.pdfKey note speaker Neum_Admir Softic_ENG.pdf
Key note speaker Neum_Admir Softic_ENG.pdf
 
Holdier Curriculum Vitae (April 2024).pdf
Holdier Curriculum Vitae (April 2024).pdfHoldier Curriculum Vitae (April 2024).pdf
Holdier Curriculum Vitae (April 2024).pdf
 
Beyond_Borders_Understanding_Anime_and_Manga_Fandom_A_Comprehensive_Audience_...
Beyond_Borders_Understanding_Anime_and_Manga_Fandom_A_Comprehensive_Audience_...Beyond_Borders_Understanding_Anime_and_Manga_Fandom_A_Comprehensive_Audience_...
Beyond_Borders_Understanding_Anime_and_Manga_Fandom_A_Comprehensive_Audience_...
 
Interdisciplinary_Insights_Data_Collection_Methods.pptx
Interdisciplinary_Insights_Data_Collection_Methods.pptxInterdisciplinary_Insights_Data_Collection_Methods.pptx
Interdisciplinary_Insights_Data_Collection_Methods.pptx
 
General Principles of Intellectual Property: Concepts of Intellectual Proper...
General Principles of Intellectual Property: Concepts of Intellectual  Proper...General Principles of Intellectual Property: Concepts of Intellectual  Proper...
General Principles of Intellectual Property: Concepts of Intellectual Proper...
 
Application orientated numerical on hev.ppt
Application orientated numerical on hev.pptApplication orientated numerical on hev.ppt
Application orientated numerical on hev.ppt
 
HMCS Max Bernays Pre-Deployment Brief (May 2024).pptx
HMCS Max Bernays Pre-Deployment Brief (May 2024).pptxHMCS Max Bernays Pre-Deployment Brief (May 2024).pptx
HMCS Max Bernays Pre-Deployment Brief (May 2024).pptx
 
UGC NET Paper 1 Mathematical Reasoning & Aptitude.pdf
UGC NET Paper 1 Mathematical Reasoning & Aptitude.pdfUGC NET Paper 1 Mathematical Reasoning & Aptitude.pdf
UGC NET Paper 1 Mathematical Reasoning & Aptitude.pdf
 

Introduction to xhtml

  • 1. Introduction to XHTML • XHTML stands for EXtensible Hyper Text 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.
  • 2. Why XHTML? • Many pages on the internet contain "bad" HTML.
  • 3. • code will work fine if you view it in a browser (even if it does NOT follow the HTML rules): <html> <head> <title>This is bad HTML</title> <body> <h1>Bad HTML <p>This is a paragraph </body>
  • 4. • Today's market consists of different browser technologies. Some browsers run on computers, and some browsers run on mobile phones or other small devices. • Smaller devices often lack the resources or power to interpret a "bad" markup language.
  • 5. Difference between HTML &XHTML • Document Structure • XHTML DOCTYPE is mandatory • The XML namespace attribute in <html> is mandatory • <html>, <head>, <title>, and <body> is mandatory
  • 6. • XHTML Elements • XHTML elements must be properly nested • XHTML elements must always be closed • XHTML elements must be in lowercase • XHTML documents must have one root element
  • 7. • XHTML Attributes • Attribute names must be in lower case • Attribute values must be quoted • Attribute minimization is forbidden
  • 8. • XHTML Elements Must Be Properly Nested wrong <b><i>This text is bold and italic</b></i> correct <b><i>This text is bold and italic</i></b>
  • 9. • XHTML Elements Must Always Be Closed Wrong <p>This is a paragraph <p>This is another paragraph correct <p>This is a paragraph</p> <p>This is another paragraph</p>
  • 10. • Empty Elements Must Also Be Closed Wrong A break: <br> A horizontal rule: <hr> An image: <img src="happy.gif" alt="Happy face"> correct A break: <br /> A horizontal rule: <hr /> An image: <img src="happy.gif" alt="Happy face" />
  • 11. • XHTML Elements Must Be In Lower Case wrong: <BODY> <P>This is a paragraph</P> </BODY> correct: <body> <p>This is a paragraph</p> </body>
  • 12. • Attribute Names Must Be In Lower Case wrong: <table WIDTH="100%"> correct: <table width="100%">
  • 13. • Attribute Values Must Be Quoted wrong: <table width=100%> Correct <table width="100%">
  • 14. • Attribute Minimization Is Forbidden Wrong <input checked> <input readonly> Correct <input checked="checked"> <input readonly="readonly">
  • 15. <meta> Tag Meta information – information about information  Provides useful information about the content of your Web site META tag is primarily used to help search engines better index a document by supplying additional information about the document. META tags includes an author's name, a description or short abstract of a document, or a set of keywords for indexing a document.
  • 16. • Providing this type of information will increase the chance that users will find your documents -- the information they want -- on the Web. • In addition to providing indexing information, META tags can also be used to refresh a Web page.
  • 17. • <meta> tags always goes inside the <head> element • It has a start tag but does not have a corresponding end tag • more than one META tag can be used within a document
  • 18. META Tag Attributes Attribute Name or http-equiv content Value Keywords Description author text Description Specifies a name for the metadata Gives the value associated with the http-equiv or name attribute
  • 19. • Define keywords for search engines: <meta name="keywords" content="HTML, CSS, XML, XHTML, JavaScript"> • Define a description of your web page: <meta name="description" content="Free Web tutorials on HTML and CSS">
  • 20. • Define the author of a page: <meta name="author" content="Hege Refsnes"> • Refresh document every 30 seconds: <meta http-equiv="refresh" content="30">
  • 21. Character entities • Reserved characters in HTML must be replaced with character entities. • It is not possible to use the less than (<) or greater than (>) signs in your text, because the browser will mix them with tags. • To actually display reserved characters, we must use character entities in the HTML source code.
  • 22. • Example <html> <head> <title>meta tag</title> <meta name="keywords" content="HTML, CSS, XML, XHTML, JavaScript"> </head> </html>
  • 23. • A character entity looks like this: • &entity_name; OR • &#entity_number;
  • 24. Useful Character Entities Result Description Entity Name Entity Number(ASCII Value) Non-breaking space &nbsp; &#160; < less than &lt; &#60; > greater than &gt; &#62; & ampersand &amp; &#38; © copyright &copy; &#169; ® registered trademark &reg; &#174; ™ trademark &trade; &#8482;
  • 25. Effect of Using Character Entities and ASCII Values &quot;Success is counted sweetest…. Copyright &#169; 2004. Kelly Valqui. Copyright (c) 2004 Prentice-Hall. All rights reserved. 25