[XHTML Tutorial] to XHTML standards (4) (XHTML Syntax)

Related Tags:

  Original Address: http://www.w3schools.com/xhtml/xhtml_syntax.asp 
  Translation: Fanweixiao 

  Writing XHTML demands a clean html syntax. 
  We need a clean Syntax to write HTML pages XHTML 
  Some More XHTML Syntax Rules: 
  More XHTML syntax: 

  Attribute Names Must Be In Lower Case 
  Attribute names must use lowercase 

  This is wrong: 
  Error code: 
  <table WIDTH="100%"> 
  This is correct: 
  Correct code: 
  <table Width="100%"> 

  Attribute values Must Be Quoted 
  Attribute value must quote 

  This is wrong: 
  Error code: 
  <table Width=100%> 
  This is correct: 
  Correct code: 
  <table Width="100%"> 

  Attribute Minimization Is Forbidden 
  Attributes abbreviated method is prohibited 
  This is wrong: 

  <dl Compact> 
  <input Checked> 
  <input Readonly> 
  <input Disabled> 
  <option Selected> 
  <frame Noresize> 

  This is correct: 

  <dl Compact="compact"> 
  <input Checked="checked" /> 
  <input Readonly="readonly" /> 
  <input Disabled="disabled" /> 
  <option Selected="selected" /> 
  <frame Noresize="noresize" /> 

  Here is a list of the minimized attributes in HTML and how they should be written in XHTML: 
  In HTML abbreviated attributes and its XHTML in writing a list of what it should: 
  HTML XHTML 
  Compact compact = "compact" 
  Checked checked = "checked" 
  Declare declare = "declare" 
  Readonly readonly = "readonly" 
  Disabled disabled = "disabled" 
  Selected selected = "selected" 
  Defer defer = "defer" 
  Ismap ismap = "ismap" 
  Nohref nohref = "nohref" 
  Noshade noshade = "noshade" 
  Nowrap nowrap = "nowrap" 
  Multiple multiple = "multiple" 
  Noresize noresize = "noresize" 

  The id Attribute Replaces The name Attribute 
  Id attribute to the use of alternative name attribute 
  HTML 4.01 defines a name attribute for the elements a, applet, frame, iframe, img, and map. In XHTML the name attribute is deprecated. Use id instead. 
  For a, applet, frame, iframe, and map img, HTML 4.01 in the definition of a name attribute in XHTML is not in favour of doing so, to replace the use of id name. 
  This is wrong: 

  <img Src="picture.gif" name="picture1" /> 

  This is correct: 

  <img Src="picture.gif" id="picture1" /> 

  Note: To interoperate with older browsers for a while, you should use both name and id, with identical attribute values, like this: 
  Note: To version of the browser relatively low presence, you should also use name and id attributes, and they should be the value of the two is the same, like this: 
  <img Src="picture.gif" id="picture1" name="picture1" /> 

  The Lang Attribute 
  Lang attributes 
  The lang attribute applies to almost every XHTML element. It specifies the language of the content within an element. 
  Lang attributes can be applied to almost all of XHTML elements.    It designated elements of the contents of the language set. 
  If you use the lang attribute in an element, you must add the xml: lang attribute, like this: 
  If you like an Element in the application lang attributes, you must add xml: lang attribute, like this: 
  <div Lang="no" xml:lang="no"> Heia Norge! </ Div> 
  Mandatory XHTML Elements 
  Mandatory elements of XHTML 
  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. 
  All XHTML documents must have a DOCTYPE reputation.    Html, head and body elements must appear, and title must appear in the head, 
  This is a minimum XHTML document template: 
  This is one of the least of XHTML document templates 
  <! DOCTYPE Doctype goes here> 
  <html Xmlns="http://www.w3.org/1999/xhtml"> 
<head>
  <title> Title goes here </ title> 
  </ Head> <body> 
  Body text goes here 
  </ 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: DOCTYPE statement is not part of their XHTML documents.    It is not XHTML elements, it has not closed at. 
  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. 
  NOTE: XHTML files of the xmlns attribute appear in the html tags.    However, the effectiveness of inspection w3.org will not be on this property does not appear in your XHTML documents and reports errors.    This is because "xmlns = http://www.w3.org/1999/xhtml" is a fixed value, even if your file does not contain it, it will be automatically added. 
  You will learn more about the XHTML document type definition in the next chapter. 
  In the next chapter of the study, you will learn more XHTL document type definition of knowledge. 

  (Reproduced Please specify the source) 




Related articles:

Fresh games are played Flash animation can also be used to watch TV
  I believe we must have seen CCTV-3 "Happy Inn Show," seen on television screens art of animation, I would like to also be able to if they like the CD-ROM burners Flash animation on the television broadcast, so no computer friends may at any time via television to watch the best Fla...
CSS control of the alternative forms color display
  <! DOCTYPE HTML PUBLIC "- / / W3C / / DTD HTML 4.0 Transitional / / EN">  <HTML> <HEAD>   <style Type="text/css">    <! --    TABLE.sample TR (background-color: expression ((this.sectionRowIndex% 2 == 0)? "...
How to label the middle DIV show?
  In the above classic forum postings found some old, that is used mostly text-align: center added BODY, and then DIV tags compared to BODY neighbors in alignment.    This article is a shortcoming in the middle of all the objects will be aligned (including text, image, etc.), this doc...
FW MX 2004 Guide (8): Dynamic button
  In the previous chapters, we already had a taste of the Fireworks MX 2004 in the image rendering performance.    From the beginning of this chapter, and we will learn in Fireworks MX 2004 on the website of the strong support functions.    We start with the production of dy...
FW shape text graphics path: University of the school badge
  In this paper, the main examples of Nankai University and drawing together all the school badge.    Our thinking is the school badge Centre placed on "Nankai" word to represent the school name, word around is a 1.80 image of the star, a star map, cut round, there is a circ...