Horje

Tips (Total 13)


# Tips-1) What is HTML Versus XHTML

XHTML is a stricter, more XML-based version of HTML.

Feature HTML XHTML
Definition Hypertext Markup Language is a markup language used to create web pages and other information that can be displayed in a web browser. eXtensible Hypertext Markup Language is a markup language that is a stricter version of HTML and conforms to XML syntax.
Syntax HTML allows for loose syntax, with end tags and attributes often being optional. XHTML requires end tags for all elements and attributes to be quoted.
Document Type Declaration (DTD) HTML allows for multiple DTDs, including HTML 4.01 and HTML5. XHTML requires the use of a specific DTD, such as XHTML 1.0 Strict or XHTML 1.1.
Namespaces HTML does not support namespaces. XHTML supports namespaces, allowing for the integration of other XML languages.
Attributes HTML allows for the use of deprecated attributes. XHTML does not allow the use of deprecated attributes and requires all attributes to be lowercase.
Deprecation HTML will continue to be supported by web browsers. XHTML support by web browsers is limited and it is now largely replaced by HTML5.
Future HTML continues to evolve, with the latest version being HTML5. XHTML development has largely been discontinued, with future developments focusing on HTML5.

 


# Tips-2) What is XHTML?


# Tips-3) Why XHTML?

XML is a markup language where all documents must be marked up correctly (be "well-formed").

XHTML was developed to make HTML more extensible and flexible to work with other data formats (such as XML). In addition, browsers ignore errors in HTML pages, and try to display the website even if it has some errors in the markup. So XHTML comes with a much stricter error handling.


# Tips-4) What is The Most Important Differences from HTML


# Tips-5) Why XHTML - <!DOCTYPE> Is Mandatory

An XHTML document must have an XHTML <!DOCTYPE> declaration.

The <html>, <head>, <title>, and <body> elements must also be present, and the xmlns attribute in <html> must specify the xml namespace for the document.

Example of XHTML - <!DOCTYPE>

Here is an XHTML document with a minimum of required tags:
index.html
Example: HTML
 <!DOCTYPE html PUBLIC "-//W3C//DTD XHTML 1.1//EN"
"http://www.w3.org/TR/xhtml11/DTD/xhtml11.dtd">
<html xmlns="http://www.w3.org/1999/xhtml">
<head>
  <title>Title of document</title>
</head>
<body>

  some content here...

</body>
</html> 


# Tips-6) Why XHTML Elements Must be Properly Nested

In XHTML, elements must always be properly nested within each other, like this:

Correct:

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

Wrong:

Example: HTML
<b><i>Some text</b></i>

# Tips-7) Why XHTML Elements Must Always be Closed

In XHTML, elements must always be closed, like this:

Correct:

Example: HTML
<p>This is a paragraph</p>
<p>This is another paragrap

Wrong:

Example: HTML
<p>This is a paragraph
<p>This is another paragraph

# Tips-8) Why XHTML Empty Elements Must Always be Closed

In XHTML, empty elements must always be closed, like this:

Correct:

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

Wrong:

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

# Tips-9) Why XHTML Elements Must be in Lowercase

In XHTML, element names must always be in lowercase, like this:

Correct:

Example: HTML
 <body>
<p>This is a paragraph</p>
</body> 

Wrong:

Example: HTML
 <BODY>
<P>This is a paragraph</P>
</BODY> 

# Tips-10) Why XHTML Attribute Names Must be in Lowercase

In XHTML, attribute names must always be in lowercase, like this:

Correct:

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

Wrong:

Example: HTML
 <a HREF="https://www.w3schools.com/html/">Visit our HTML tutorial</a> 

# Tips-11) Why XHTML Attribute Values Must be Quoted

In XHTML, attribute values must always be quoted, like this:

Correct:

Example: HTML
 <a href="https://horje.com/html/">Visit our HTML tutorial</a> 

Wrong:

Example: HTML
 <a href=https://horje.com/html/>Visit our HTML tutorial</a> 

# Tips-12) Why XHTML Attribute Minimization is Forbidden

In XHTML, attribute minimization is forbidden:

Correct:

Example: HTML
<input type="checkbox" name="vehicle" value="car" checked="checked" />
<input type="text" name="lastname" disabled="disabled" /> 

Wrong:

Example: HTML
<input type="checkbox" name="vehicle" value="car" checked />
<input type="text" name="lastname" disabled />

# Tips-13) How to Validate HTML With The W3C Validator

Just replace the https://horje.com and input your website then run to browser.

URL Check on w3.org

https://validator.w3.org/nu/?doc=https://horje.com


Share on: