Εισαγωγή στο XHTML
- Προηγούμενη σελίδα Πρόχειρο Εγχειρίδιο HTML
- Επόμενη σελίδα Εлементα XHTML
XHTML 是以 XML 格式编写的 HTML。
XHTML is HTML written in XML format.
- What is XHTML?
- XHTML refers to 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 XML XHTML isJanuary 2001
- W3C recommended standard published
XHTML is supported by all mainstream browsers
Why use XHTML?
Many pages on the Internet contain 'bad' HTML.
If viewed 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
Today's technology industry has 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 redesigned HTML as XML.
The most important difference compared to HTML:
- document structuremandatory
- XHTML DOCTYPE ismandatory
- The XML namespace attribute in <html> is alsomandatory
element syntax
- XHTML elements mustbe correctly nested
- XHTML elements must alwaysbe closed
- XHTML elements mustin lowercase
- An XHTML document must havea root element
attribute syntax
- XHTML attributes must usein lowercase
- XHTML attribute values must besurrounded by quotes
- The minimization of XHTML attributes is alsoProhibited
<!DOCTYPE ....> is mandatory
An XHTML document must declare the XHTML document type (XHTML DOCTYPE declaration).
You can find the complete reference manual for tags on CodeW3C.com. XHTML Document Type.
The <html>, <head>, <title>, and <body> elements must also exist, and the xmlns attribute in <html> must be used to define the XML namespace for the document.
Το παρακάτω παράδειγμα δείχνει ένα XHTML έγγραφο με τις λιγότερες απαραίτητες ετικέτες:
!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>Τίτλος του έγγραφου</title> </head> <body> ...... </body> </html>
Πώς να μετατρέψετε HTML σε XHTML
- Προσθέστε το <!DOCTYPE> XHTML στο πρώτο γραμμάτι της κάθε σελίδας
- Προσθέστε την ιδιότητα xmlns στο στοιχείο html κάθε σελίδας
- Μετατρέψτε τα ονόματα των στοιχείων σε μικρά γράμματα
- Κλείστε όλες τις κενές ετικέτες
- Μετατρέψτε τα ονόματα των ιδιοτήτων σε μικρά γράμματα
- Προσθέστε εισαγωγικά σε όλες τις τιμές ιδιοτήτων
Επιβεβαιώστε το XHTML με τον έλεγχο W3C
Γράψτε την διεύθυνση του ιστότοπου σας στο παρακάτω πλαίσιο κειμένου:
Δοκιμή XHTML
Η δοκιμή περιλαμβάνει 20 ερωτήσεις και δεν υπάρχει χρονικό όριο.
Η δοκιμή αυτή δεν είναι επίσημη και είναι ένα καλό τρόπο για να κατανοήσετε το επίπεδο γνώσης σας για το XHTML.
Κάθε σωστή απάντηση αποφέρει 1 πόντο. Στο τέλος της δοκιμής θα εμφανιστεί ο συνολικός σας βαθμός. Ο μέγιστος βαθμός είναι 20 πόντοι.
- Προηγούμενη σελίδα Πρόχειρο Εγχειρίδιο HTML
- Επόμενη σελίδα Εлементα XHTML