Curriculum
Course: HTML Basic
Login

Curriculum

HTML Basic

HTML Introduction

0/1

HTML Editors

0/1

HTML Elements

0/1

HTML Attributes

0/1

HTML Headings

0/1

HTML Paragraphs

0/1

HTML Styles

0/1

HTML Formatting

0/1

HTML Quotation

0/1

HTML Comments

0/1

HTML Colors

0/1

HTML Favicon

0/1

HTML Page Title

0/1

HTML Block and Inline

0/1

HTML Iframes

0/1

HTML Java Script

0/1

HTML File Paths

0/1

HTML - The Head Element

0/1

HTML Style Guide

0/1

HTML Entities

0/1

HTML Symbols

0/1
Text lesson

HTML Versus XHTML

What is XHTML?

XHTML, short for EXtensible HyperText Markup Language, represents a more stringent, XML-oriented iteration of HTML. It’s essentially HTML conceptualized as an XML application and garners support from all major browsers.

Why XHTML?

XML serves as a markup language requiring all documents to be correctly marked up, or “well-formed.”

XHTML emerged with the aim of enhancing HTML’s extensibility and adaptability to collaborate with other data formats, notably XML.

Moreover, while browsers typically overlook errors in HTML pages and attempt to display websites despite markup flaws, XHTML adopts a significantly stricter approach to error handling.

The Most Important Differences from HTML

The following guidelines apply:

  • The use of <!DOCTYPE> is obligatory.
  • The xmlns attribute within <html> is required.
  • <html>, <head>, <title>, and <body> elements are obligatory.
  • Proper nesting of elements is imperative.
  • Elements must be consistently closed.
  • Elements should be consistently in lowercase.
  • Attribute names should be consistently in lowercase.
  • Attribute values must be enclosed in quotes.
  • Attribute minimization is prohibited.

XHTML Elements Must be Properly Nested

In XHTML, elements must always be correctly nested within one another, as shown:

Correct:

<b><i>Some text</i></b>

Wrong:

<b><i>Some text</b></i>

XHTML Elements Must Always be Closed

In XHTML, elements must always be properly closed, as demonstrated:

Correct:

<p>This is a paragraph</p>
<p>This is another paragraph</p>

Wrong:

<p>This is a paragraph
<p>This is another paragraph

XHTML Empty Elements Must Always be Closed

In XHTML, empty elements must always be closed, as depicted:

Correct:

A break: <br />
A horizontal rule: <hr />
An image: <img src=”happy.gif” alt=”Happy face” />

Wrong:

A break: <br>
A horizontal rule: <hr>
An image: <img src=”happy.gif” alt=”Happy face”>

XHTML Elements Must be in Lowercase

In XHTML, element names must always be in lowercase, as illustrated:

Correct:

<body>
<p>This is a paragraph</p>
</body>

Wrong:

<BODY>
<P>This is a paragraph</P>
</BODY>

XHTML Attribute Names Must be in Lowercase

In XHTML, attribute names must always be in lowercase, as exemplified:

Correct:

<a href=”https://www.code7schools.com/html/”>Visit our HTML tutorial</a>

Wrong:

<a HREF=”https://www.code7schools.com/html/”>Visit our HTML tutorial</a>

XHTML Attribute Values Must be Quoted

In XHTML, attribute values must always be enclosed in quotes, as shown:

Correct:

<a href=”https://www.code7schools.com/html/”>Visit our HTML tutorial</a>

Wrong:

<a href=https://www.code7schools.com/html/>Visit our HTML tutorial</a>

XHTML Attribute Minimization is Forbidden

In XHTML, attribute minimization is not permitted:

Correct:

<input type=”checkbox” name=”vehicle” value=”car” checked=”checked” />
<input type=”text” name=”lastname” disabled=”disabled” />

Wrong:

<input type=”checkbox” name=”vehicle” value=”car” checked />
<input type=”text” name=”lastname” disabled />