0% found this document useful (0 votes)
2 views

Module-7-XHTML

XHTML, or Extensible Hypertext Markup Language, is a stricter and cleaner version of HTML developed by the W3C, requiring well-formed documents that follow strict syntax rules. It differs from HTML in features such as mandatory tag closing, case sensitivity, and the necessity for proper nesting and lowercase elements. Additionally, XML principles apply to XHTML, including having one root element and properly quoted attribute values.

Uploaded by

lapzcarl802
Copyright
© © All Rights Reserved
We take content rights seriously. If you suspect this is your content, claim it here.
Available Formats
Download as PDF, TXT or read online on Scribd
0% found this document useful (0 votes)
2 views

Module-7-XHTML

XHTML, or Extensible Hypertext Markup Language, is a stricter and cleaner version of HTML developed by the W3C, requiring well-formed documents that follow strict syntax rules. It differs from HTML in features such as mandatory tag closing, case sensitivity, and the necessity for proper nesting and lowercase elements. Additionally, XML principles apply to XHTML, including having one root element and properly quoted attribute values.

Uploaded by

lapzcarl802
Copyright
© © All Rights Reserved
We take content rights seriously. If you suspect this is your content, claim it here.
Available Formats
Download as PDF, TXT or read online on Scribd
You are on page 1/ 15

Introduction to XHTML

What is XHTML?
XHTML stands for Extensible Hypertext Markup Language.
Developed by the W3C (World Wide Web Consortium), XHTML is more strict and
cleaner than HTML.
XHTML documents must be well-formed and follow strict syntax rules.
What is XML?
XML stands for Extensible Markup
Language.
It is a markup language designed to
store and transport data.
Unlike HTML, XML is not concerned
with how data looks, but rather what the
data "is".
It allows users to create their own tags
and define document structures.
Difference Between XHTML and HTML

Features HTML XHTML


Syntax Flexible Strict
Tag closing Optional for some tags Mandatory
Case sensitivity Not case sensitive Tags must be lowercase
Compatibility Browser specific XML-compliant parsers
Structure Can be loose Must be well-formed
Proper Nesting
Tags in XHTML must be properly nested.
Incorrect: <b><i>Text</b></i>
Correct: <b><i>Text</i></b>
Improper nesting can cause display or validation errors in XHTML documents.
Proper Tag Closing
All XHTML elements must be closed.
Examples:
- Self-closing tags must end with '/': <br />
- Paired tags must close: <p>Paragraph</p>
Elements in Lowercase
All tags and element names in XHTML must be written in lowercase.
Example:
- Correct: <html>, <body>
- Incorrect: <HTML>, <Body>
This rule ensures XML compatibility.
One Root Element
Every XHTML document must have exactly one root element.
Typically, this is the <html> element which wraps all other content.
Structure:
<html>
<head></head>
<body></body>
</html>
Attributes in Lowercase
Attribute names must also be in lowercase and properly quoted.
Correct: <input type='text' value='Hello' />
Incorrect: <input TYPE=TEXT VALUE=Hello>
Basic XML Rules
- Must have one root element.
- Tags must be properly nested.
- Tags must be closed.
- Attribute values must be in quotes.
- Case-sensitive: <Title> is different from <title>.
Create xhtml file
File extension is .xhtml
XHTML example
Result
Comparison

HTML XHTML
Result

HTML XHTML
Result after
removing / in
<br>.

You might also like