XHTML consists of all the elements in HTML 4.01 combined with the syntax of XML.
Differences Between XHTML And HTML
An XHTML document consists of three main parts:
DOCTYPE (It Is Mandatory)A DOCTYPE is a commitment to follow the rules of a given markup language. Essentially, you are saying to a machine: “Anything that I send you will conform to the markup rules of the named DTD. So process what I send you according to those rules”. For this reason, if markup that you supply does not conform to the specified rules, Web browsers or other devices may not process your markup as expected.
There are three XHTML DTDs:
<!DOCTYPE html PUBLIC "-//W3C//DTD XHTML 1.0 Strict//EN" "http://www.w3.org/TR/xhtml1/DTD/xhtml1-strict.dtd">
Use the strict DOCTYPE when you want really clean markup, free of presentational clutter. Use together with CSS.
<!DOCTYPE html PUBLIC “-//W3C//DTD XHTML 1.0 Transitional//EN” “http://www.w3.org/TR/xhtml1/DTD/xhtml1-transitional.dtd”>
Use the transitional DOCTYPE when you want to still use HTML’s presentational features.
Use the frameset DOCTYPE when you want to use HTML Frames to split the web page into two or more frames.
Note: The DOCTYPE declaration is not a part of the XHTML document itself. It is not an XHTML element, and it should not have a closing tag.
XHTML 1.1 DOCTYPE should only be used when Web pages are served as XML:
<!DOCTYPE html PUBLIC "-//W3C//DTD XHTML 1.1//EN" "http://www.w3.org/TR/xhtml11/DTD/xhtml11.dtd">
The following elements are deprecated in favor of style sheets. They are not used in Strict DOCTYPE by may use in Transitional and Frameset DOCTYPE :
The following elements are also deprecated:
XHTML tag reference |
||||||||
| Tag Name | Description | Attributes | Contains | |||||
|---|---|---|---|---|---|---|---|---|
| Basic | Advanced | Core | Intern | Event* | Style | |||
| Declarations | ||||||||
| XML Declaration | When XHTML is served as XML | |||||||
| DOCTYPE Declaration | Within the HTML/XHTML family of markup languages, | |||||||
| Structure & Header Elements | ||||||||
| base | An absolute URL to resolve relative URLs | href | nothing | |||||
| body | Holds content of the document | onload
onunload |
class
id title |
xml:lang
dir |
1-10 | style | Block elements | |
| head | Holds additional information about the document | profile | xml:lang
dir |
title
base link meta script style object |
||||
| html | Root element of the document | xmlns | version | xml:lang
dir |
head
body |
|||
| link | Link to another resource | href
media type |
charset
hreflang rel rev |
class
id title |
xml:lang
dir |
1-10 | style | nothing |
| meta | Additional information about the document | content name | http-equiv
scheme |
xml:lang
dir |
nothing | |||
| script | Client-side script | src
type |
charset
defer xml:space |
class
id title |
xml:lang
dir |
1-10 | style | text |
| style | CSS style information | media
title type |
xml:space | xml:lang
dir |
text | |||
| title | Document title | xml:lang
dir |
text | |||||
| Block Elements | ||||||||
| address | Identify contact information for a document | class
id title |
xml:lang
dir |
1-10 | style | inline elements
text |
||
| blockquote | Long quotation | cite | class
id title |
xml:lang
dir |
1-10 | style | block elements | |
| del | Deleted content | cite
datetime |
class
id title |
xml:lang
dir |
1-10 | style | block elements
inline elements text |
|
| div | Generic way to group areas of content | class
id title |
xml:lang
dir |
1-10 | style | block elements
inline elements text |
||
| dl | Definition list | class
id title |
xml:lang
dir |
1-10 | style | dt
dd |
||
| fieldset | Form control group | class
id title |
xml:lang
dir |
1-10 | style | block elements
inline elements legend text |
||
| form | Data entry form | action
method |
accept
accept-charsets enctype onreset onsubmit |
class
id title |
xml:lang
dir |
1-10 | style | block elements (except form)
fieldset |
| h1 | Level 1 heading | class
id title |
xml:lang
dir |
1-10 | style | inline-elements
text |
||
| h2 | Level 2 heading | class
id title |
xml:lang
dir |
1-10 | style | inline-elements
text |
||
| h3 | Level 3 heading | class
id title |
xml:lang
dir |
1-10 | style | inline-elements
text |
||
| h4 | Level 4 heading | class
id title |
xml:lang
dir |
1-10 | style | inline-elements
text |
||
| h5 | Level 5 heading | class
id title |
xml:lang
dir |
1-10 | style | inline-elements
text |
||
| h6 | Level 6 heading | class
id title |
xml:lang
dir |
1-10 | style | inline-elements
text |
||
| hr | Content separator | class
id title |
xml:lang
dir |
1-10 | style | nothing | ||
| ins | Inserted content | cite
datetime |
class
id title |
xml:lang
dir |
1-10 | style | block elements
inline elements text |
|
| noscript | Alternate content for client-side script | class
id title |
xml:lang
dir |
1-10 | style | block elements | ||
| ol | Ordered list | class
id title |
xml:lang
dir |
1-10 | style | li | ||
| p | Paragraph | class
id title |
xml:lang
dir |
1-10 | style | inline elements
text |
||
| pre |
|
xml:space | class
id title |
xml:lang
dir |
1-10 | style | inline elements
(except img, object, big, small, sub, and sup) text |
|
| script | Client-side script | src
type |
charset
defer xml:space |
class
id title |
xml:lang
dir |
1-10 | style | text |
| table | Table | border
cellpadding cellspacing summary width |
frame
–void –above –below –hsides –vsides –lhs –rhs –box –border rules –none –group –rows –cols –all |
class
id title |
xml:lang
dir |
1-10 | style | caption
col colgroup thead tfoot tbody tr |
| ul | Unordered list | class
id title |
xml:lang
dir |
1-10 | style | li | ||
| Inline Elements | ||||||||
| a | A hyperlink | href | accesskey
charset coords hreflang onblur onfocus rel rev shape tabindex type |
class
id title |
xml:lang
dir |
1-10 | style | inline elements
(except a) text |
| abbr | An abbreviation | class
id title |
xml:lang
dir |
1-10 | style | inline-elements
text |
||
| acronym | An acronym | class
id title |
xml:lang
dir |
1-10 | style | inline-elements
text |
||
| b | Instruction to render text in bold style | class
id title |
xml:lang
dir |
1-10 | style | inline-elements
text |
||
| bdo | Bidirectional text override | dir | class
id title |
xml:lang
dir |
1-10 | style | inline-elements
text |
|
| big | Instruction to render text in a large font | class
id title |
xml:lang
dir |
1-10 | style | inline-elements
text |
||
| button | Form button control | name
type –submit –reset –button value |
accesskey
disabled onblur onfocus tabindex |
class
id title |
xml:lang
dir |
1-10 | style | block elements (except form and fieldset)
inline-elements (except button, input, label, select, and textarea) text |
| cite | Citation or reference to other source | class
id title |
xml:lang
dir |
1-10 | style | inline-elements
text |
||
| code | Computer code | class
id title |
xml:lang
dir |
1-10 | style | inline-elements
text |
||
| del | Deleted content | cite
datetime |
class
id title |
xml:lang
dir |
1-10 | style | block elements
inline elements text |
|
| dfn | Contains the defining instance of the enclosed term | class
id title |
xml:lang
dir |
1-10 | style | inline elements
text |
||
| em | Indicates emphasis | class
id title |
xml:lang
dir |
1-10 | style | inline elements
text |
||
| i | Instruction to render text in italic style | class
id title |
xml:lang
dir |
1-10 | style | inline elements
text |
||
| img | Image | alt
height src weight |
simap
longdesc usemap |
class
id title |
xml:lang
dir |
1-10 | style | nothing |
| ins | Inserted content | cite
datetime |
class
id title |
xml:lang
dir |
1-10 | style | block elements
inline elements text |
|
| input | Form control | alt
checked maxlength name size type –text –password –checkbox –radio –submit –image –reset –button –hidden –file value |
accept
accesskey disabled ismap onblur onchange onfocus onselect readonly src tabindex usemap |
class
id title |
xml:lang
dir |
1-10 | style | nothing |
| label | Form control label | for | accesskey
onblur onfocus |
class
id title |
xml:lang
dir |
1-10 | style | inline elements (except label)
text |
| map | Client-side image map | class
id (req) title |
xml:lang
dir |
1-10 | style | block elements
area |
||
| kbd | Indicates input to be entered by the user | class
id title |
xml:lang
dir |
1-10 | style | inline elements
text |
||
| object | Generic embedded object | classid
codebase height name type width |
archive
codetype data declare standby tabindex usemap |
class
id title |
xml:lang
dir |
1-10 | style | block elements (not rec)
inline elements param text |
| q | Short quotation | cite | class
id title |
xml:lang
dir |
1-10 | style | inline elements
text |
|
| samp | Designates sample output from programs, scripts, etc. | class
id title |
xml:lang
dir |
1-10 | style | inline elements
text |
||
| script | Client-side script | src
type |
charset
defer xml:space |
class
id title |
xml:lang
dir |
1-10 | style | text |
| select | Option selector form control | multiple
name type |
disabled
onblur onchange onfocus tabindex |
class
id title |
xml:lang
dir |
1-10 | style | optiongroup
option |
| small | Instruction to render text in a small font | class
id title |
xml:lang
dir |
1-10 | style | inline elements
text |
||
| span | Generic way to add structure to content | class
id title |
xml:lang
dir |
1-10 | style | inline elements
text |
||
| strong | Indicates stronger emphasis | class
id title |
xml:lang
dir |
1-10 | style | inline elements
text |
||
| sub | Subscript | class
id title |
xml:lang
dir |
1-10 | style | inline elements
text |
||
| sup | superscript | class
id title |
xml:lang
dir |
1-10 | style | inline elements
text |
||
| textarea | Multi-line text field form control | cols
name rows |
accesskey
disabled onblur onchange onfocus onselect readonly tabindex |
class
id title |
xml:lang
dir |
1-10 | style | text |
| tt |
|
class
id title |
xml:lang
dir |
1-10 | style | inline elements
text |
||
| var | Indicates instance of a computer code variable or program argument | class
id title |
xml:lang
dir |
1-10 | style | inline elements
text |
||
| List Item Elements | ||||||||
| dd | Definition description | class
id title |
xml:lang
dir |
1-10 | style | block elements
inline elements text |
||
| dt | Definition term | class
id title |
xml:lang
dir |
1-10 | style | inline elements
text |
||
| li | Ordered/unordered list item | class
id title |
xml:lang
dir |
1-10 | style | block elements
inline elements text |
||
| Table Content Elements | ||||||||
| caption | Table caption | class
id title |
xml:lang
dir |
1-10 | style | inline elements
text |
||
| col | Define attributes for a table column | align
–left –center –right –justify –char span valign –top –middle –bottom –baseline width |
char
charoff |
class
id title |
xml:lang
dir |
1-10 | style | nothing |
| colgroup | Define attributes for a group of table columns | align
–left –center –right –justify –char span valign –top –middle –bottom –baseline width |
char
charoff |
class
id title |
xml:lang
dir |
1-10 | style | col |
| tbody | Body area for a table | align
–left –center –right –justify –char valign –top –middle –bottom –baseline |
char
charoff |
class
id title |
xml:lang
dir |
1-10 | style | tr |
| td | Table cell containing data | align
–left –center –right –justify –char colspan headers rowspan valign –top –middle –bottom –baseline |
axis
char charoff |
class
id title |
xml:lang
dir |
1-10 | style | block elements
inline elements text |
| tfoot | Footer area for a table | align
–left –center –right –justify –char valign –top –middle –bottom –baseline |
char
charoff |
class
id title |
xml:lang
dir |
1-10 | style | tr |
| th | Table cell containing header | abbr
align –left –center –right –justify –char colspan rowspan valign –top –middle –bottom –baseline |
axis
char charoff scope |
class
id title |
xml:lang
dir |
1-10 | style | block elements
inline elements text |
| thead | Heading area for a table | align
–left –center –right –justify –char valign –top –middle –bottom –baseline |
char
charoff |
class
id title |
xml:lang
dir |
1-10 | style | tr |
| tr | Table row | align
–left –center –right –justify –char valign –top –middle –bottom –baseline |
char
charoff |
class
id title |
xml:lang
dir |
1-10 | style | td
th |
| Form Fieldset Legends | ||||||||
| legend | Caption to a fieldset | accesskey | class
id title |
xml:lang
dir |
1-10 | style | inline elements
text |
|
| Form Menu Options | ||||||||
| optgroup | A grouping of selectable choices in an option selector form control | label | disabled | class
id title |
xml:lang
dir |
1-10 | style | option |
| option | A selectable choice in an option selector form control | selected
value |
disabled
label |
class
id title |
xml:lang
dir |
1-10 | style | text |
| Map Areas | ||||||||
| area | Client-side image map area | alt
coords –rect –circle –poly href shape –default –rect –circle –poly |
accesskey
onblur onfocus nohref tabindex |
class
id title |
xml:lang
dir |
1-10 | style | nothing |
| Object Parameters | ||||||||
| param | Embedded object customization properties | name
value |
id
type valuetype –data –ref –object |
noting | ||||
*EVENTS:
|
||||||||