XHTML Basics Introductory Tutorials

Source: Internet
Author: User
Tags add empty end execution extend functions object model version
HTML Basics |xhtml| Tutorials | Getting Started

  Summary

XHTML 1.0 is a HTML4 that has been redesigned as a XML1.0 application. This specification defines XHTML 1.0 and the 3 document type definitions (dtd,document type definition) that correspond to HTML 4. The semantics of each element and their attributes are already defined in the recommendation for HTML 4, which is the basis for future extensions of XHTML. XHTML documents can be compatible with existing HTML user agents as long as you follow a small set of guidelines.

  The status of this document

This section describes the status of this document when it was published. Other documents may be substituted for this document. The Consortium is responsible for maintaining the latest status of this document family. This document is reviewed by members of the consortium and some interested groups, and is recognized by the supervisor as the recommended standard for the consortium. This is a stable document that can be used as a reference material or as a standard reference in other documents. The purpose of this recommendation is to draw attention to the specification, to make it widely available, and to enhance the functionality and interoperability of the web.

  1. What is XHTML?

XHTML is a series of current and future document types and program blocks, which are regenerated and extended by HTML 4 [HTML], and HTML 4 is a subset of them. XHTML series documents are based on XML and are ultimately designed to work with xml-based user agents. Details of the XHTML family and their development process are detailed in the future Trends section.

XHTML 1.0 (This specification book) is the first document of the XHTML family. It was 1.0 after applying 3 kinds of HTML 4 document types to XML (XML). The intention is that, as a language, its content conforms to XML and can be identified by HTML4 user agents if they follow a few simple guidelines. Developers will be able to transplant their documents into XHTML 1.0, with the following benefits:

XHTML documents conform to XML. This makes it easy to view, edit, and validate them with standard XML tools.

XHTML documents can be used in existing HTML4 proxy user programs, or they can be used in new XHTML user agents, which can achieve the same or better effect as the former.

Applications used in XHTML documents, such as script and applets, can be either the Document Object model of HTML or the Document Object model of XML [DOM].

With the development of the XHTML family, documents conforming to XHTML 1.0 are more likely to be used in a variety of XHTML environments.

The XHTML family is the next step in the development of the Internet. By porting documents to XML now, developers can also enjoy the benefits of entering the XML world while ensuring that their documents are compatible.

  1.1 What is HTML 4?

HTML 4 [HTML] is an application of SGML (Standard generalized Markup Language) that complies with ISO 8879 and is widely used as the standard publishing language on the World Wide Web.

SGML is a language that describes markup languages, especially those used in electronic document exchange, document management, and document publishing languages. HTML is an instance of the language defined by SGML.

SGML appeared in the middle of the 80 and has remained stable. Stability is the result of its rich characteristics and flexibility. However, flexibility brings a degree of complexity that limits its adaptability in a variety of environments, including the world Wide Web.

HTML was originally conceived as a language for exchanging scientific and other technical documents for use by experts unfamiliar with writing documents. HTML provides a small set of structural semantic tags that are suitable for writing relatively simple documents, thus solving the problem of SGML complexity. In addition to simplifying the document structure, HTML also adds support for hypertext, adding media capabilities later.

In a very short time, HTML became widely popular and quickly exceeded its original purpose. The new elements within the HTML (standard) are created quickly, and HTML is quickly adapted for use in vertical, highly specialized markets. Additional new elements result in a document compatibility issue across platforms.

As software and platform inconsistencies increase, it is clear that the applicability of "classic" HTML 4 on these platforms is limited.

  1.2 What is XML?

Xml[xml] is the abbreviation of Extensible Markup Language, the purpose of which is to regain the ability and flexibility of SGML and remove most of its complexity. Although a restricted SGML form, XML retains most of the functionality and richness of SGML, and retains all the common features of SGML.

While preserving these useful features, XML removes many of the more complex features of SMGL, which make it difficult and expensive to write and design the right software.

  1.3 Why do I need XHTML?

The benefits of porting to XHTML have been mentioned above, and in general, the benefits of porting to XHTML are:

Document developers and user agent programmers often use new methods, new tags to express their ideas. It is relatively easy to import new elements and new element attributes with XML. The XHTML family is designed to provide these extensions, through XHTML modules and the development of new XHTML-compliant modules. (will be described in the upcoming XHTML modular specification). These modules will allow you to mix existing and new feature sets when developing documents and designing new user agents.

Various alternative ways of accessing the Internet are constantly being presented. Some people estimate that by 2002, 75% of documents on the Internet will be viewed on these alternative platforms. XHTML is designed to take into account the collaborative work of user agents. With a new user agent and document protocol mechanism, servers, agents, and user agents will be able to best meet the transmission, and finally, it is possible to develop documents that follow XHTML and be used by any user agent that adheres to XHTML.

  2. Define

  2.1 Terminology

The following terms are used in this specification book. These entries are based on similar definitions in the ISO/IEC 9945-1:1990 [posix.1] and are defined in [RFC2119]:

Execution definition (implementation-defined)

When a value or behavior is defined, it is executed to define the appropriate needs to interpret the document correctly.

Can (May)

When executed, the word "may" is interpreted as an optional feature, which is not required in this specification, but can be provided. For document consistency, the word "yes" means that you cannot use an optional attribute. The definition of "optional" (optional) and "can" is the same.

Must (MUST)

In this specification, "must" is interpreted as enforced or for the mandatory requirements of strict adherence to XHTML documents. The terms "should" (shall) and "must" are defined the same.

Reserved (Reserved)

A value or behavior is not specified, but is not allowed for documents that conform to specifications and is not supported by a compliant user agent.

Should (Should)

At execution time, "should" be interpreted as a recommendation for execution, but not a must. For documents, the "should" is interpreted as a recommended use for programming exercises, and is necessary for documents that adhere to XHTML.

be supported (supported)

Some functions in this specification book are optional, and if a function is supported, its behavior is stipulated in this specification book.

Not Specified (Unspecified)

When a value or behavior is not specified, the specification book does not define the portability requirements of a feature, even if it is used in a document. In this case, a document that needs to specify the behavior, rather than allowing any behavior when using this feature, is not a document that adheres strictly to XHTML.

  2.2 Common Entries

Attributes (attribute)

A property is an argument to an element that is declared in a DTD. The type and range of values of the property, including its possible default values, are defined in the DTD.

Dtd

A DTD, also known as a document type definition, is an XML declaration collection that defines the legitimate structure, elements, and attributes that are used in documents that conform to DTDs.

Documents (document)

A document is a data flow and includes other data flows that it references. The structure of a document is organized to hold information in the relevant DTD-defined elements. For more information, please refer to Document conformance.

Elements (Element)

An element is a structural unit of a document declared in a DTD. The content model of the element is defined in the DTD, and additional semantics can be defined in the other element description.

function (Facilities)

Features include elements, attributes, and semantics related to element attributes. Supporting the execution of these functions is said to provide the required functionality.

Execution (Implementation)

Execution means that the system provides a set of features and services to support this specification book. For more information, refer to the user Agent conformance.

Analysis (parsing)

Parsing is the act of scanning a document, which contains information that is filtered into the context structure of the element.

Display (Rendering)

Display is the action that the document information is rendered. The display is done in the most suitable environment (e.g. sound, visual, print).

Users agent (user agents)

The user agent is the executing program that gets and processes the XHTML document. For more information, check the user Agent conformance.

Validation (Validation)

Validation is the process of validating a document with a related DTD to be sure of the structure, the use of elements, and the use of attributes in accordance with the definitions in the DTD.

Good format (well-formed)

The structure of a well-formed document is governed by the provisions of section 2.1 of sections 2.1 of the XML1.0 recommended standard [XML]. Basically, this definition defines that the element must have a start and end tag, and that it should be nested correctly.

  3. Standard definition of XHTML 1.0

  3.1 Document consistency

This version of XHTML provides strict adherence to the XHTML document definition, subject to the tags and attributes provided by the XHTML name address. For information that uses XHTML's other address spaces, such as the metadata expressed by RDF, see section 3.1.2.

  3.1.1 Strictly follow the document.

A document that adheres strictly to XHTML requires only the mandatory functionality described in this specification, and must comply with the following criteria:

It must be validated by one of the DTDs in Appendix A appendix A, 3.

The root element of the document must be

The root element of the document must specify the XHTML name address with the xmlns attribute [xmlnames]. The name of the XHTML address is defined in http://www.w3.org/1999/xhtml.

Before the root element, there must be a DOCTYPE declaration. The public identifiers contained in the DOCTYPE declaration must reference one of the 3 DTDs in Appendix A, appendix A, each with its own official public identifier. System identifiers can be changed to fit the local system.

<! DOCTYPE html
Public "-//W3C//DTD XHTML 1.0 strict//en"
"Dtd/xhtml1-strict.dtd" >

<! DOCTYPE html
Public "-//W3C//DTD XHTML 1.0 transitional//en"
"Dtd/xhtml1-transitional.dtd" >

<! DOCTYPE html
Public "-//W3C//DTD XHTML 1.0 frameset//en"
"Dtd/xhtml1-frameset.dtd" >

The following is an example of a minimal XHTML document:

<?xml version= "1.0" encoding= "UTF-8"?>
<! DOCTYPE html
Public "-//W3C//DTD XHTML 1.0 strict//en"
"Dtd/xhtml1-strict.dtd" >
<title>virtual library</title>
<body>
<p>moved to <a href= "vlib.org.http://vlib.org/" >vlib.org</a>.</p>
</body>

Note that the XML declaration is included in this example. XML declarations are not required in all XML documents. XHTML is strongly recommended for use with XML declarations. Such a declaration is required when the character encoding is not the default UTF-8 or UTF-6.

  3.1.2 Use of other name-address spaces in XHTML

Other XML name address spaces can be used [xmlnames] in the XHTML name address space, although such documents are not strictly compliant with XHTML documents. The consortium will later be committed to specifying consistency for multiple address spaces.

The following examples illustrate the methods used jointly by the XHTML1.0 and MathML recommended standards.

<title>a Math example</title>
<body>
<p>the Following is MathML markup:</p>
<math xmlns= "Http://www.w3.org/1998/Math/MathML" >
<apply> <log/>
<logbase>
<cn> 3 </cn>
</logbase>
<ci> x </ci>
</apply>
</math>
</body>

The following example illustrates how XHTML1.0 and other XML address spaces are used jointly:

<?xml version= "1.0" encoding= "UTF-8"?>
<!--initially,the Default namespace is ' books '-->
<book xmlns= ' Urn:loc.gov:books '
xmlns:isbn= ' urn:isbn:0-395-36341-6 ' xml:lang= "en" lang= "en" >
<title>cheaper by the Dozen</title>
<isbn:number>1568491379</isbn:number>
<notes>
<!--make HTML the default namespace for a hypertext commentary-->
<p xmlns= ' http://www.w3.org/1999/xhtml ' >
This is also available <a href= "onlinehttp://www.w3.org/" >ONLINE</A>.
</p>
</notes>
</book>

  3.2 User Agent Consistency

A compliant user agent must comply with all of the following criteria:

For consistent with XML1.0 recommendation [XML], user agents must analyze and evaluate the orchestration of XHTML documents. If the user agent claims to be a user agent with authentication capabilities, it must also validate the document in accordance with the DTD referenced by the [XML] security document.

When the user agent claims to support the functional facilities defined in this specification book, it must be supported by functional definition.

When a user agent processes an XHTML document in general XML, it should recognize only the attributes of the ID type, such as the id attribute of most XHTML elements, as fragment identifiers.

If the user agent encounters an element that it does not recognize, it must display the contents of the element.

If the user agent encounters a property that it does not recognize, it must ignore the definition of the entire property (that is, the attribute and its value).

If the user agent encounters a property value that it does not recognize, it must use the default value for the property.

If it encounters an entity reference (not a predefined entity), the user agent has not processed its declaration (if the declaration occurs in an external subset that the user agent does not read), the entity reference should be displayed as a character (beginning with A &, ending with a half colon) to be formatted as an entity reference.

When the content is displayed, the user agent should tell the user in a conspicuous way that an exception appears if it encounters a character that it does not recognize, but does not display a character entity reference.

The following characters are defined as whitespace (whitespace) characters in [XML]:

Space ()
Tab ()
Carriage return ()
Line Wrap ()

The XML handler normalizes the line end code of the different systems into a single newline to be passed to the application. Therefore, XHTML must also consider the following characters as whitespace characters:

Change page ()
0 width space ()
For an element with the ' Xml:space ' attribute set to ' reserved ', the user agent must keep all white-space characters intact (except for the boot and trailing whitespace, which should be deleted). Otherwise, whitespace characters are processed in the following rules:

Whitespace characters around all block elements should be deleted.
All annotations are removed without affecting the processing of whitespace characters. A white space on either side of the note is processed to two whitespace guides and the trailing whitespace character should be removed the newline character within the block element must be converted to a space (the ' Xml:space ' property is set to the exception of ' reserved ').

A string of contiguous whitespace characters must be reduced to a single space (except when the ' Xml:space ' property is set to ' reserved ').

When displayed, the user agent should display in the appropriate way the language in which the contents of the document are written for the contents of the document. In languages that are mainly Latin, ASCII spaces are typically used to encode grammatical boundaries and typographical gaps; In languages related to Nagari writing (such as Sanskrit, Thai, etc.), grammatical boundaries can be encoded with ZW whitespace characters, but are generally not represented in printed spaces when displaying output; In the Arabic form of the language of the writing body, you can use the space character code printed on the blank, single can not use ZW space delimitation of the internal grammatical demarcation (for example, in English appears to be a word of ' kitabuhum ' = ' kitabu-hum ' = ' book them ' = = ' their book, Encoded in Arabic as several words); Chinese writing habits generally do not use this way to encode boundaries or to print blanks.

The whitespace in the value of the property is handled in the form of [XML].

  4. The difference from HTML 4

Because XHTML is an application of XML, some of the completely legitimate habits in SGML-based HTML 4 must be changed in XHTML.

  4.1 Documents must be well choreographed

The choreography of good well-formedness is a new concept introduced in [XML]. Essentially, this means that the element must have an end tag, or it must be written in a special way (described below).

Elements must be nested, although the SGML rules stack illegally, but existing browsers generally allow cascading.

Correct: nested elements.
<p>here is a emphasized <em>paragraph</em>.</p>

Incorrect: cascading elements.
<p>here is a emphasized <em>paragraph.</p></em>

  4.2 element and attribute names must be lowercase

XHTML documents must use lowercase for all HTML element and attribute names. Because XML is case sensitive, this difference is necessary. such as <li> and <LI> are different labels.

  4.3 Pairs of non-empty elements, the end tag must be used

In SGML based HTML 4, some implicitly end-meaning elements allow the end tag to be ignored. In xml-based XHTML, this omission is not allowed. All elements must have an end tag, except for elements declared empty in the DTD.

Correct: The end of the element.
<p>here is-a paragraph.</p><p>here is another paragraph.</p>

Incorrect: element not closed.
<p>here is a paragraph.<p>here is another paragraph.

  4.4 Attribute values must be in quotation marks

All attributes must be in quotes, even numbers.

Correct: attribute value in quotation marks
<table rows= "3" >

Incorrect: property value not in quotation marks.
<table rows=3>

  4.5 Attribute Minimization

XML does not support the minimization of attributes. Attribute value pairs must be fully written. Property names such as compact,checked cannot be specified in an element without specifying a property value.

Correct: No properties minimized
<DL compact= "compact" >

Incorrect: Minimizing properties
<DL compact>

  4.6 Empty elements

An empty element must either have an end tag, or the start tag ends with/>. For example,<br/> or

Correct: An empty element that ends
<br/>

Error: Empty label not closed
<br>

  4.7 White-space character processing in attribute values

For attribute values, the user agent deletes the boot and subsequent blank characters and converts one or more whitespace characters, including line breaks, to a single character space (an ASCII space in the western script), 3.3.3 of [XML].

  4.8 Script and Style elements

In XHTML, script and style elements are declared as #pcdata content forms, so,< and & are considered the beginning of identity, and entities such as &LT and & are viewed as entity references by XML handlers and are considered < and & respectively . Wrapping the contents of the script and style elements in the CDATA notation section avoids the expansion of these entities.

<script>
<! [cdata[
... unescaped script content ...
]]>
</script>

CDATA parts are recognized by XML handlers and are a node in the Document Object model. See the DOM Level 1 recommended standard [DOM] for section 1.3, 1.3.

The alternative is to use external script and style documents.

  4.9 SGML forbids

SGML to the author's DTD can specify elements that are not allowed to appear inside an element. Such a ban is not possible in XML.

For example, the strict HTML 4 DTD prohibits any depth of the ' a ' element from nesting to another ' a ' element. Such a prohibition cannot be written in XML. Although these prohibitions cannot be defined in the DTD, some elements should not be nested. In the standardized Appendix B Appendix B is a summary of these elements.

4.10 Elements with ' id ' and ' name ' attributes

The element of HTML 4 that defines the Name property has a A,applet,form,frame,iframe,img,and map. The id attribute is also introduced in HTML 4. Both of these properties are designed as fragment identifiers.

In XML, the fragment identifier is an ID type, and each element can have only one attribute of the ID type. Therefore, in XHTML1.0, the id attribute is defined as the ID type. To ensure that the XHTML1.0 document is a well-formed XML document, when defining a fragment identifier, the XHTML document must use the id attribute, even for those elements that previously used the name attribute. See the information in HTML compatibility Guidelines to ensure that XHTML documents are used in text/html media type, and these anchors are backward compatible.

Note that in XHTML 1.0, the Name property is not officially supported and will be deleted in later versions of XHTML.

  5. Compatibility issues

Although XHTML does not have to be compatible with an existing user agent, it is easy to implement in operation. Guidelines for creating compatible documents are in Appendix C.

  5.1 Internet Media Type

The generic MIME label problem for xml-based applications has not been resolved when this recommended standard is published.

However, XHTML documents that follow the guidelines in Appendix C can be labeled as "text/html" media types because they are compatible with most browsers. This document does not recommend other MIME tags for XHTML documents.

  6. Future trends

XHTML 1.0 provides the basis for a class of document types that extend XHTML and contain XHTML subsets. To support a wide range of new devices and applications, define modules and specify the mechanisms for combining these modules. This mechanism will define the new module in a uniform way to extend and subset XHTML.

  6.1 Modular HTML

Because XHTML applications move from traditional desktop user agents to other platforms, it is clear that all XHTML elements are not necessarily used on all platforms. For example, a device on the hand or a cellular phone can support only a subset of XHTML elements.

The modular process divides XHTML into a series of small sets of elements. They can be combined again when different situations are needed.

These modules will be defined in future document of the consortium.

  6.2 Subsets and scalability

Modularity brings several benefits:

Provides a formal mechanism for the subset of XHTML.
Provides a formal mechanism for extending XHTML.
simplifies the transformation between document types.
Facilitates the reuse of modules in new document types.

  6.3 Document Protocol

Document protocols indicate the syntax and semantics of a set of documents. Adherence to document protocols provides the basis for ensuring document interoperability. The document protocol specifies the functionality required to process such a document, such as what type of image file you can use, the level of the script, the support for the style sheet, and so on.

For product designers, this allows different groups to define their own standard protocols.

For the author. This allows them to avoid writing different versions of the document for different customers.

For professional groups, such as chemists, physicians, or mathematicians, this allows for a special protocol to be built with standard HTML elements plus a set of elements that fit the needs of the expert.

  Appendix A. DTDs

This appendix is standardized.

These DTDs and entities constitute a standardized part of this specification book. This specification book is full of DTD file sets as well as XML declarations and SGML open directories in a zip file file.

  A.1 Document type definition (DOC type definitions)

These DTDs are similar to HTML 4 DTDs. After the DTD is modularized, the method used by the widget DTD may be more relevant to HTML 4.

Xhtml-1.0-strict
Xhtml-1.0-transitional
Xhtml-1.0-frameset

  A.2 Entity set

The entity set of XHTML is the same as HTML 4, but is decorated as a valid XML 1.0 entity declaration. Note that the entity of the European currency symbol (€or€ or €) is defined in the special symbol section.

Latin-1 characters
Special characters
Symbols

  Appendix B. Prohibited Elements

This appendix is normative.

The following elements are prohibited when they contain other elements (see section 4.9). These prohibitions apply to all depths of nesting, that is, the Pao element.

A

Cannot contain other a elements.

Pre

Cannot contain img,object,big,small,sub, or SUP elements.

button

Cannot contain input,select,textarea,label,button,form,fieldset,iframe or isindex elements.

Label

Cannot contain other label elements.

Form

Cannot contain other form elements.

  Appendix C. HTML Compatibility Guide

This appendix is informative.

This appendix summarizes the design-time guidelines that instruct authors to write XHTML documents that can be displayed in an existing HTML user agent.

 C.1 Processing Instructions

Some user agents display processing instructions. However, note that when there is no XML declaration in the document, the document can only be UTF-8 or UTF-16 with the default character encoding.

 C.2 Empty Element

Add a space before the empty element terminator/and >, such as <br/>,

  C.3 element minimization and empty element content

The content model is not an empty element, in an empty place (such as an empty title or an empty paragraph), not in a minimized form (such as with <p> </p> without <p/>).

  C.4 embedded style sheets and script

If your style sheet uses < or & or]]> or-, use an external style sheet. If your script is in < or & or]]> or--with an external script. Note that the XML Analyzer will remove the contents of the annotation without being informed. As a result, the custom of "hiding" script and style sheets in a previously annotated way makes documents backward compatible, but may not work as expected in xml-based execution.

  C.5 in attribute value internal Branch

Avoid the use of branches and multiple spaces in attribute values. The user agent does not work in the same situation.

  C.6 Isindex

Do not use more than one ISINDEX element in the head section of the document. The Isindex element is not approved for use and is in favor of using the INPUT element.

  C.7 Lang and Xml:lang properties

Use the Lang and Xml:lang properties while specifying the language of the element. Xml:lang attribute in front.

  C.8 fragment Identifier

In XML, ending fragment identifier URI [RFC2396] in the form of "#foo" does not mean that the element has an attribute name= "foo", but that the element has an attribute defined as an ID type, such as an id attribute in HTML 4. Many HTML clients do not support ID type attributes in this way, so you can attach the same value to both properties to ensure maximum backward and forward compatibility. (such as <a id= "foo" name= "foo" >...</a>).

In addition, the Name property is changed to NmToken because the set of legal values for the ID type attribute is much smaller than the set of values for the CDATA Type property. This property is limited to the same value as the name product in the ID type or XML1.0 2.5 section. Unfortunately, the XHTML DTD does not represent this limitation. Because of this change, you should take note when converting existing HTML documents. If the value of the conversion may change, the values of these properties must be unique in the document, valid, and any references to those fragment identifiers, whether internal or external, must be updated.

Finally, note that you are not in favor of using the name attribute in A,applet,form,frame,iframe,img, and in the map element, which will be removed in future XHTML versions.

  C.9 character encoding

To specify the character encoding in the document, specify the encoding attribute in the XML declaration (such as. <?xml version= "1.0" encoding= "EUC-JP"?>) and use HTTP-EQUIV statements in meta (such as <meta http-equiv= "Content-type" content= ' text/html; charset= "Euc-jp" '/>). The encoding attribute value of the XML processing instruction is in the previous.

  C.10 Boolean Property

Some HTML user agents cannot interpret Boolean properties when they occur in full (not minimized) Form, which is XML1.0 necessary. Note that this issue does not affect the user agent's compatibility with HTML 4. Includes some of the following properties: Compact,nowrap,ismap,declare,noshade,checked,disabled,readonly,multiple,selected,noresize,defer.

  C.11 Document Object Model and XHTML

Document Object Model Level 1 recommends that the standard [DOM] defines the Document object model for XML and HTML 4. The HTML 4 Document Object model stipulates that HTML element names and property names are returned in uppercase form. The XML Document Object model specifies that element names and property names are returned in the form they are specified. In XHTML 1.0, elements and attributes are specified in lowercase. This significant difference can be dealt with in two ways:

Applications that access text/html Internet media type XHTML documents through the DOM can use the HTML DOM, and can also rely on the uppercase element names and property names returned by these interfaces.

Applications that access Text/xml or application/xml Internet media type XHTML documents through the DOM can also use the XML DOM. Element names and property names are returned in lowercase. Also, some XHTML elements may or may not be present in the object tree, because they are optional in the content model (such as the TBODY element in the table). In HTML 4, some elements can be minimized so that their start and end tags are ignored (SGML features), so it can happen. But not in XML. XHTML makes elements optional, rather than inserting foreign elements by document authors. Accordingly, the application needs to adapt to this.

  c.12 using & in attribute values

When a property value contains a & symbol, it must be represented by a character entity reference (that is, "&"). For example, when an element's HREF attribute points to a CGI script that receives parameters, it must be represented as Http://my.site.dom/cgi-bin/myscript.pl?class=guest&name=user, not http ://my.site.dom/cgi-bin/myscript.pl?class=guest&name=user.

  c.13 cascading style sheets and XHTML

Cascading style sheet Level 2 the recommended standard [CSS2] defines the properties of style, which is used to parse the tree structure of HTML and XML documents. An analysis of the impassability will result in different visual or auditory effects, depending on the selector used. The following techniques can reduce this effect on a document without modifying the two media types:

XHTML CSS style sheets should be in lowercase elements and attribute names.

In the table, the TBODY element is inferred by the parser of the HTML user agent, but the parser for the XML user agent does not do so. So if you want to be referenced in a CSS selector, you should always add tbody elements clearly.

In the XHTML name address space, the user agent will recognize the "id" attribute as an attribute of an ID type. Therefore, even if the user agent does not recognize the DTD, the style sheet should be able to continue to use "#" to simplify the selector syntax.

In the XHTML name address space, the user agent will recognize the class attribute, so the style sheet should be able to construct the continue use of "." Simplifies selector syntax.

CSS defines different conformance criteria for HTML and XML documents; An XML rule is used when an XHTML document is expressed in HTML, in HTML rules, in an XHTML document in XML.



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.