XHTML learning records

Source: Internet
Author: User
Document directory
  • XHTML 1.0 strict
  • XHTML 1.0 transitional
  • XHTML 1.0 frameset
What is XHTML?
  • XHTML refers to the Extensible hypertext markup language ).
  • The goal of XHTML is to replace HTML.
  • The XHTML and HTML 4.01 are almost the same.
  • XHTML is a more rigorous and pure HTML Version.
  • XHTML is the HTML that is redefined as an XML application.
  • XHTML is a W3C standard.

XHTML is a combination of HTML and XML (Extended Markup Language.

XHTML contains all HTML 4.01 elements combined with XML syntax.

 

Major differences:
  • XHTML elements must be correctly nested.
  • The XHTML element must be disabled.
  • The tag name must contain lowercase letters.
  • The XHTML document must have the root element.

 

More XHTML syntax rules:

  • The property name must be in lowercase.
  • The attribute value must be enclosed in quotation marks.
  • Attribute cannot be abbreviated
  • Replace the name attribute with the ID attribute
  • Xhtml dtd defines mandatory HTML elements

 

Mandatory XHTML Elements

All XHTML documents must declare the file type (doctype Declaration ). The HTML, Head, and body elements must exist in the XHTML document, and the title element must be in the head element.

Below is a minimal XHTML file template:

<!DOCTYPE Doctype goes here>
Three XML document types in XHTML 1.0

XHTML 1.0 specifies three types of XML documents to correspond to the above three DTD types.

XHTML 1.0 strict
<!DOCTYPE htmlPUBLIC "-//W3C//DTD XHTML 1.0 Strict//EN""http://www.w3.org/TR/xhtml1/DTD/xhtml1-strict.dtd">

In this case, a clean mark is required to avoid confusion. Use it with the stacked style sheet.

XHTML 1.0 transitional
<!DOCTYPE htmlPUBLIC "-//W3C//DTD XHTML 1.0 Transitional//EN""http://www.w3.org/TR/xhtml1/DTD/xhtml1-transitional.dtd">

In this case: When you need to use HTML's performance features, and you need to write XHTML for browsers that do not support stacked style sheets.

XHTML 1.0 frameset
<!DOCTYPE htmlPUBLIC "-//W3C//DTD XHTML 1.0 Frameset//EN""http://www.w3.org/TR/xhtml1/DTD/xhtml1-frameset.dtd">

In this case, you need to use the HTML framework to split the browser window into two or more frames.

Core Attributes)

The following tags do not provide the following attributes: Base, Head, HTML, Meta, Param, script, style, and title.

Attribute Value Description
Class Class_rule or style_rule Element class)
ID Id_name A specific ID of an element
Style Style Definition Inline style Definition
Title Prompt text Text displayed in the prompt Tool
Language attributes)

The following tags do not provide the following attributes: Base, BR, frame, frameset, HR, IFRAME, Param, and script elements.

Attribute Value Description
Dir LTr | RTL Set the text direction
Lang Language code Set language code
Keyboard attributes)
Attribute Value Description
Accesskey Character Set the keyboard shortcut for accessing an element
Tabindex Quantity Set the tab order of an element
Window events)

Valid only in the body and frameset elements.

Attribute Value Description
Onload Script Execute the script when the document is loaded.
OnUnload Script Execute the script when the document is detached.
Form element event (form Element events)

Valid only in form elements.

Attribute Value Description
Onchange Script Execute the script when the element changes.
Onsubmit Script Execute the script when the form is submitted.
Onreset Script Execute the script when the form is reset.
Onselect Script Execute the script when the element is selected.
Onblur Script Execute the script when the element loses focus
Onfocus Script Execute the script when the element gets focus
Keyboard Events)

The following elements are invalid: Base, BDO, BR, frame, frameset, Head, HTML, IFRAME, Meta, Param, script, style, and title.

Attribute Value Description
Onkeydown Script Execute the script when the keyboard is pressed
Onkeypress Script Execute the script when the keyboard is pressed and loose.
Onkeyup Script Execute the script when the keyboard is released
Keyboard Events)

The following elements are invalid: Base, BDO, BR, frame, frameset, Head, HTML, IFRAME, Meta, Param, script, style, and title.

Attribute Value Description
Onclick Script Execute the script when the mouse is clicked
Ondblclick Script Execute the script when the mouse is double-clicked.
Onmousedown Script Execute the script when the mouse button is released
Onmousemove Script Execute the script when the mouse pointer moves
Onmouseout Script Execute the script when the mouse pointer removes an element.
Onmouseover Script Execute the script when the cursor is hovering over an element.
Onmouseup Script Execute the script when the mouse button is released

Contact Us

The content source of this page is from Internet, which doesn't represent Alibaba Cloud's opinion; products and services mentioned on that page don't have any relationship with Alibaba Cloud. If the content of the page makes you feel confusing, please write us an email, we will handle the problem within 5 days after receiving your email.

If you find any instances of plagiarism from the community, please send an email to: info-contact@alibabacloud.com and provide relevant evidence. A staff member will contact you within 5 working days.

A Free Trial That Lets You Build Big!

Start building with 50+ products and up to 12 months usage for Elastic Compute Service

  • Sales Support

    1 on 1 presale consultation

  • After-Sales Support

    24/7 Technical Support 6 Free Tickets per Quarter Faster Response

  • Alibaba Cloud offers highly flexible support services tailored to meet your exact needs.