XHTML

XHTML Syntax
  • XHTML is a stricter and cleaner version of HTML.
  • In addition, you should start NOW to write your HTML code in lowercase letters, and NEVER skip ending tags (like </p>).
  • XHTML Elements Must Be Properly Nested
  • XHTML Elements Must Always Be Closed
  • Empty Elements Must Also Be Closed
  • XHTML Elements Must Be In Lower Case
  • XHTML Documents Must Have One Root Element
  • Attribute Values Must Be Quoted
  • Attribute Minimization Is Forbidden

    HTMLXHTML 
    compactcompact="compact"
    checkedchecked="checked"
    declaredeclare="declare"
    readonlyreadonly="readonly"
    disableddisabled="disabled"
    selectedselected="selected"
    deferdefer="defer"
    ismapismap="ismap"
    nohrefnohref="nohref"
    noshadenoshade="noshade"
    nowrapnowrap="nowrap"
    multiplemultiple="multiple"
    noresizenoresize="noresize"
  • The id Attribute Replaces The name Attribute

    To make your XHTML compatible with today's browsers, you should add an extra space before the "/" symbol.
  • Mandatory XHTML Elements

    All XHTML documents must have a DOCTYPE declaration. The html, head and body elements must be present, and the title must be present inside the head element.
    This is a minimum XHTML document template:
    <! DOCTYPE Doctype goes here >
    < html  xmlns ="http://www.w3.org/1999/xhtml" >
    < head >
    < title > Title goes here </ title >
    </ head >< body >
    </ body ></ html >

    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.

    Note: The xmlns attribute inside the <html> tag is required in XHTML. However, the validator on w3.org does not complain when this attribute is missing in an XHTML document. This is because "xmlns=http://www.w3.org/1999/xhtml" is a fixed value and will be added to the <html> tag even if you do not include it.


XHTML DTD

The XHTML standard defines three Document Type Definitions.

  • <!DOCTYPE> Is Mandatory
  • An XHTML document consists of three main parts:
    • the DOCTYPE
    • the Head
    • the Body
  • This is a simple (minimal) XHTML document:
    <! DOCTYPE html
    PUBLIC "-//W3C//DTD XHTML 1.0 Strict//EN"
    "http://www.w3.org/TR/xhtml1/DTD/xhtml1-strict.dtd"
    >
    < html >
    < head >
    < title > simple document </ title >
    </ head >
    < body >
    < p > a simple paragraph </ p >
    </ body >
    </ html >
  • The 3 Document Type Definitions
    • DTD specifies the syntax of a web page in SGML.
    • DTD is used by SGML applications, such as HTML, to specify rules that apply to the markup of documents of a particular type, including a set of element and entity declarations.
    • XHTML is specified in an SGML document type definition or 'DTD'.
    • An XHTML DTD describes in precise, computer-readable language, the allowed syntax and grammar of XHTML markup.

There are currently 3 XHTML document types:
  • STRICT
  • TRANSITIONAL
  • FRAMESET
XHTML Modularization
With modular XHTML, designers can:
  • Choose the elements to be supported by a device using standard XHTML building blocks
  • Add extensions to XHTML, using XML, without breaking the XHTML standard
  • Simplify XHTML for devices like hand held computers, mobile phones, TV, and home appliances
  • Extend XHTML for complex applications by adding new XML functionality (like MathML, SVG, Voice and Multimedia)
  • Define XHTML profiles like XHTML Basic (a subset of XHTML for mobile devices)

  • XHTML Modules

W3C has split the definition of XHTML into 28 modules:

Module nameDescription
Applet ModuleDefines the deprecated* applet element
Base ModuleDefines the base element
Basic Forms ModuleDefines the basic forms elements
Basic Tables ModuleDefines the basic table elements
Bi-directional Text ModuleDefines the bdo element
Client Image Map ModuleDefines browser side image map elements
Edit ModuleDefines the editing elements del and ins
Forms ModuleDefines all elements used in forms
Frames ModuleDefines the frameset elements
Hypertext ModuleDefines the a element
Iframe ModuleDefines the iframe element
Image ModuleDefines the img element
Intrinsic Events ModuleDefines event attributes like onblur and onchange
Legacy ModuleDefines deprecated* elements and attributes
Link ModuleDefines the link element
List ModuleDefines the list elements ol, li, ul, dd, dt, and dl
Metainformation ModuleDefines the meta element
Name Identification ModuleDefines the deprecated* name attribute
Object ModuleDefines the object and param elements
Presentation ModuleDefines presentation elements like b and i
Scripting ModuleDefines the script and noscript elements
Server Image Map ModuleDefines server side image map elements
Structure ModuleDefines the elements html, head, title and body
Style Attribute ModuleDefines the style attribute
Style Sheet ModuleDefines the style element
Tables ModuleDefines the elements used in tables
Target ModuleDefines the target attribute
Text ModuleDefines text container elements like p and h1

* Deprecated elements should not be used in XHTML.

Link:

HTML 4.01 / XHTML 1.0 Reference

转载于:https://www.cnblogs.com/vam/archive/2007/06/27/797441.html

评论
添加红包

请填写红包祝福语或标题

红包个数最小为10个

红包金额最低5元

当前余额3.43前往充值 >
需支付:10.00
成就一亿技术人!
领取后你会自动成为博主和红包主的粉丝 规则
hope_wisdom
发出的红包
实付
使用余额支付
点击重新获取
扫码支付
钱包余额 0

抵扣说明:

1.余额是钱包充值的虚拟货币,按照1:1的比例进行支付金额的抵扣。
2.余额无法直接购买下载,可以购买VIP、付费专栏及课程。

余额充值