XHTML Inleiding
- Vorige pagina HTML Snellaesboek
- Volgende pagina XHTML Elementen
XHTML 是以 XML 格式编写的 HTML。
XHTML is HTML written in XML format.
- What is XHTML?
- XHTML stands for Extensible Hypertext Markup Language
- XHTML is almost the same as HTML 4.01
- XHTML is a stricter and purer version of HTML
- XHTML is defined as HTML applied in the way of XML XHTML isJanuary 2001
- Published W3C recommended standard
XHTML is supported by all mainstream browsers
Why use XHTML?
Many web pages on the Internet contain 'bad' HTML.
If you view it in a browser, the following HTML code runs very normally (even though it does not comply with HTML rules): <head> <html> <body> <title>This is bad HTML</title> <h1>Bad HTML </body>
<p>This is a paragraph
XML is a markup language that must be marked correctly and be well-formed. If you want to learn XML, please read our.
XML Tutorial
In today's technology industry, there are some different browser technologies. Some run on computers, while others may run on mobile phones or other small devices. Small devices often lack the resources and capabilities to interpret 'bad' markup languages.
So - by combining the strengths of XML and HTML, XHTML was developed. XHTML is a re-designed HTML as XML.
The most important difference compared to HTML:
- document structuremandatory
- The XHTML DOCTYPE ismandatory
- The XML namespace attribute in <html> is alsomandatory
element syntax
- XHTML elements mustbe correctly nested
- XHTML elements must alwaysclosed
- XHTML elements mustin lowercase
- An XHTML document must havea root element
attribute syntax
- XHTML attributes must usein lowercase
- XHTML attribute values must beEnclosed in quotes
- XHTML attribute minimization is alsoProhibited
The declaration <!DOCTYPE ....> is mandatory
An XHTML document must have an XHTML document type declaration (XHTML DOCTYPE declaration).
You can find the complete reference manual for tags on CodeW3C.com. XHTML document type.
The elements <html>, <head>, <title> and <body> must also exist, and the xmlns attribute in <html> must be used to define the XML namespace for the document.
Het volgende voorbeeld toont een XHTML-document met de minste benodigde tags:
<!DOCTYPE html PUBLIC "-//W3C//DTD XHTML 1.0 Transitional//EN" "http://www.w3.org/TR/xhtml1/DTD/xhtml1-transitional.dtd"> <html xmlns="http://www.w3.org/1999/xhtml"> <head> <title>Dokumententitel</title> </head> <body> ...... </body> </html>
Hoe van HTML naar XHTML te converteren
- Voeg het XHTML <!DOCTYPE> aan de eerste regel van elke pagina toe
- Voeg de xmlns-eigenschap toe aan het html-element van elke pagina
- Maak alle elementnamen klein
- Sluit alle lege elementen
- Maak alle eigenschapnamen klein
- Voeg aan alle eigenschapswaarden aanhalingstekens toe
Controleer uw XHTML met de W3C Verifier
Voer uw URL in in het onderstaande tekstvak:
XHTML Test
De test bevat 20 vragen en heeft geen tijdslimiet.
Deze test is niet-formeel en biedt een goede manier om uw kennis van XHTML te evalueren.
Elke juiste antwoord krijgt 1 punt. Na het einde van de test wordt uw totale score weergegeven. De hoogste score is 20 punten.
- Vorige pagina HTML Snellaesboek
- Volgende pagina XHTML Elementen