Tài liệu HTML & CSS: The Complete Reference- P8 doc

50 442 0
Tài liệu HTML & CSS: The Complete Reference- P8 doc

Đang tải... (xem toàn văn)

Tài liệu hạn chế xem trước, để xem đầy đủ mời bạn chọn Tải xuống

Thông tin tài liệu

326 P a r t I : C o r e M a r k u p 326 P a r t I : C o r e M a r k u p Compatibility No standards support Netscape 3, 4, 4.5–4.8 Notes • Page developers are strongly encouraged not to use this element. Netscape dropped this element for its own browsers starting with version 6.0. The inclusion in this book of this element is for support of existing documents only. • The facilities of this element are better handled using the CSS multicolumn properties discussed in Chapter 6. <nav> (Navigation) This HTML5 element represents a group of links to other locations either inside or outside of a document. HTML5 Standard Syntax <nav accesskey="spaced list of accelerator key(s)" class="class name(s)" contenteditable="true | false | inherit" contextmenu="id of menu" data-X="user-defined data" dir="ltr | rtl" draggable="true | false | auto" hidden="hidden" id="unique alphanumeric identifier" itemid="microdata id in URL format" itemprop="microdata value" itemref="space-separated list of IDs that may contain microdata" itemscope="itemscope" itemtype="microdata type in URL format" lang="language code" spellcheck="true | false" style="style information" tabindex="number" title="advisory text"> text and elements particularly links </nav> HTML5 Event Attributes onabort, onblur, oncanplay, oncanplaythrough, onchange, onclick, oncontextmenu, ondblclick, ondrag, ondragend, ondragenter, ondragleave, ondragover, ondragstart, ondrop, ondurationchange, onemptied, onended, onerror, onfocus, onformchange, onforminput, oninput, oninvalid, onkeydown, onkeypress, onkeyup, onload, onloadeddata, onloadedmetadata, onloadstart, onmousedown, onmousemove, onmouseout, onmouseover, onmouseup, onmousewheel, onpause, onplay, onplaying, onprogress, onratechange, onreadystatechange, Please purchase PDF Split-Merge on www.verypdf.com to remove this watermark. C h a p t e r 3 : H T M L a n d X H T M L E l e m e n t R e f e r e n c e 327 C h a p t e r 3 : H T M L a n d X H T M L E l e m e n t R e f e r e n c e 327 PART I onscroll, onseeked, onseeking, onselect, onshow, onstalled, onsubmit, onsuspend, ontimeupdate, onvolumechange, onwaiting Example <nav> <ul> <li><a href="about.html">About</a></li> <li><a href="services.html">Services</a></li> <li><a href="contact.html">Contact</a></li> <li><a href="index.html">Home</a></li> </ul> </nav> Compatibility HTML5 Not currently supported by any browser, but addressed with a custom element. Notes • Links are not restricted to occur solely within <nav> tags. The intent of this element is that it collects navigation together often as a unit; commonly this would be primary or secondary site navigation or possibly page-related links. • While this element is not yet supported, it is easily simulated by using a custom tag or using a <div> tag with a special class. <nobr> (No Line Breaks) This proprietary element renders enclosed text without line breaks. Break points for where text may wrap can be inserted using the wbr element or related workarounds. Common Syntax <nobr class="class name(s)" id="unique alphanumeric identifier" style="style information" title="advisory text"> </nobr> Attributes Defined by Internet Explorer contenteditable=" false | true | inherit " (5.5) dir="ltr | rtl" (5.5) disabled="false | true" (5.5) unselectable="on | off" (5.5) Events Defined by Internet Explorer onbeforeactivate, onbeforecopy, onbeforecut, onbeforeedit, onbeforepaste, oncopy, oncut, ondrag, ondragend, ondragenter, ondragleave, ondragover, ondragstart, ondrop, onfocusin, onfocusout, onhelp, onlosecapture, onmouseenter, onmouseleave, onmousewheel, onpaste, onpropertychange, onreadystatechange, onscroll, onselectstart Please purchase PDF Split-Merge on www.verypdf.com to remove this watermark. 328 P a r t I : C o r e M a r k u p 328 P a r t I : C o r e M a r k u p Examples <nobr>This really long text will not be broken.</nobr> <nobr>With this element it is often important to hint where a line may be broken using &lt;wbr&gt;.<wbr> This element acts as a soft return.</ nobr> Compatibility No standards support Firefox 1+, Internet Explorer 4+, Netscape 1.1+, Opera 4+ Notes • While many browsers support this attribute, it is not part of any W3C standard. • See the “<wbr> (Word Break)” section later in the chapter for a discussion of how to implement soft-break functionality without the proprietary wbr element. <noembed> (No Embedded Media Support) This Netscape-introduced element is used to indicate alternative content to be displayed on browsers that cannot support an embedded media object. It should occur in conjunction with the embed element. Proprietary Syntax (Initially Defined by Netscape) <noembed class="class name" id="unique id" style="CSS rules" title="advisory text"> Alternative content for browsers that do not support embed </noembed> Element-Specific Attributes Netscape does not specifically define attributes for this element; however, testing and documentation suggests that class, id, style, and title might be supported for this element in many browsers. Example <embed src="trailer.mov" height="300" width="300"> <noembed> <img src="error.gif" alt="Error"> <p>This browser is not configured to display video</p> </noembed> </embed> Compatibility No standards support Netscape 2, 3, 4–4.7 Please purchase PDF Split-Merge on www.verypdf.com to remove this watermark. C h a p t e r 3 : H T M L a n d X H T M L E l e m e n t R e f e r e n c e 329 C h a p t e r 3 : H T M L a n d X H T M L E l e m e n t R e f e r e n c e 329 PART I Note • Even if other browsers do not support the tag and render the contents of a <noembed> tag, it works in the manner it was designed, given how browsers handle unknown elements. <noframes> (No Frame Support Content) This element is used to indicate alternative content to be displayed on browsers that do not support frames. Standard Syntax <noframes class="class name(s)" dir="ltr | rtl" id="unique alphanumeric identifier" lang="language code" style="style information" title="advisory text"> Alternative content for browsers that do not support frames </noframes> HTML 4 Event Attributes onclick, ondblclick, onkeydown, onkeypress, onkeyup, onmousedown, onmousemove, onmouseout, onmouseover, onmouseup Event Defined by Internet Explorer onreadystatechange Example <frameset rows="100,*"> <frame name="nav" src="controls.html"> <frame name="body" src="content.html"> <noframes> <p>Sorry, this browser does not support frames.</p> </noframes> </frameset> Compatibility HTML 4, 4.01 (transitional and frameset) XHTML 1.0 (transitional and frameset) Firefox 1+, Internet Explorer 2+, Netscape 2+, Opera 4+, Safari 1+ Notes • This element should be used within the scope of the frameset element. • This element has no inclusion under HTML5 because standard frames are not included in that specification. Please purchase PDF Split-Merge on www.verypdf.com to remove this watermark. 330 P a r t I : C o r e M a r k u p 330 P a r t I : C o r e M a r k u p • The benefit of events and sophisticated attributes, such as style, is unclear for browsers that would use content within <noframes>, given that older browsers that don’t support frames probably would not support these features. <noscript> (No Script Support Content) This element is used to enclose content that should be rendered on browsers that do not support scripting or that have scripting turned off. Syntax <noscript class="class name(s)" dir="ltr | rtl" id="unique alphanumeric identifier" lang="language code" style="style information" title="advisory text"> Alternative content for non-script-supporting browsers </noscript> Attributes Introduced by HTML5 accesskey="spaced list of accelerator key(s)" contenteditable="true | false | inherit" contextmenu="id of menu" data-X="user-defined data" draggable="true | false | auto" hidden="hidden" itemid="microdata id in URL format" itemprop="microdata value" itemref="space-separated list of IDs that may contain microdata" itemscope="itemscope" itemtype="microdata type in URL format" spellcheck="true | false" tabindex="number" HTML 4 Event Attributes onclick, ondblclick, onkeydown, onkeypress, onkeyup, onmousedown, onmousemove, onmouseout, onmouseover, onmouseup HTML5 Event Attributes onabort, onblur, oncanplay, oncanplaythrough, onchange, onclick, oncontextmenu, ondblclick, ondrag, ondragend, ondragenter, ondragleave, ondragover, ondragstart, ondrop, ondurationchange, onemptied, onended, onerror, onfocus, onformchange, onforminput, oninput, oninvalid, onkeydown, onkeypress, onkeyup, onload, onloadeddata, onloadedmetadata, onloadstart, onmousedown, onmousemove, onmouseout, onmouseover, onmouseup, onmousewheel, onpause, onplay, onplaying, onprogress, onratechange, onreadystatechange, onscroll, onseeked, onseeking, onselect, onshow, onstalled, onsubmit, onsuspend, ontimeupdate, onvolumechange, onwaiting Please purchase PDF Split-Merge on www.verypdf.com to remove this watermark. C h a p t e r 3 : H T M L a n d X H T M L E l e m e n t R e f e r e n c e 331 C h a p t e r 3 : H T M L a n d X H T M L E l e m e n t R e f e r e n c e 331 PART I Event Defined by Internet Explorer onreadystatechange Examples <script type="type/javascript"> <! window.location="http://www.pint.com"; // > </script> <noscript> <p>JavaScript is not supported. Follow this <a href="http://www.pint.com">link</a> instead.</p> </noscript> <! HTML5 refresh trick > <!DOCTYPE html> <html> <head> <meta http-equiv="Content-Type" content="text/html; charset=utf-8"> <title>Web Application</title> <! require script on > <noscript> <meta http-equiv="Refresh" content="0;URL=/errors/noscript.html"> </noscript> <! more head content follows > Compatibility HTML 4, 4.01, 5 XHTML 1.0, 1.1 Firefox 1+, Internet Explorer 3+, Netscape 2+, Opera 4+, Safari 1+ Note • Besides using the noscript element, it may be wise to employ a comment mask around any script code that is embedded rather than linked. Oddly, under HTML 4 <noscript> is not allowed in the head even though <script> is. Under HTML5 it is allowed, though with a limited set of content within it and is not defined when XML syntax is used. <object> (Embedded Object) This element specifies an arbitrary object to be included in an HTML document. Initially, this element was used to insert ActiveX controls, but according to the specification, an object can be any media object, document, applet, interactive control, or even image. Standard Syntax <object align="bottom | left | middle | right | top" (transitional only) archive="URL" border="percentage | pixels" (transitional only) Please purchase PDF Split-Merge on www.verypdf.com to remove this watermark. 332 P a r t I : C o r e M a r k u p 332 P a r t I : C o r e M a r k u p class="class name(s)" classid="id" codebase="URL" codetype="MIME Type" data="URL of data" declare="declare" dir="ltr | rtl" height="percentage | pixels" hspace="percentage | pixels" (transitional only) id="unique alphanumeric identifier" lang="language code" name="unique alphanumeric name" standby="standby text string" style="style information" tabindex="number" title="advisory text" type="MIME Type" usemap="URL" vspace="percentage | pixels" (transitional only) width="percentage | pixels"> param elements and alternative rendering </object> Attributes Introduced by HTML5 accesskey="spaced list of accelerator key(s)" contenteditable="true | false | inherit" contextmenu="id of menu" data-X="user-defined data" draggable="true | false | auto" hidden="hidden" itemid="microdata id in URL format" itemprop="microdata value" itemref="space-separated list of IDs that may contain microdata" itemscope="itemscope" itemtype="microdata type in URL format" spellcheck="true | false" Attributes Defined by Internet Explorer accesskey="character" (4) align="absbottom | absmiddle | baseline | texttop" (4) code="URL" (4) datafld="column name" (4) data hidefocus="true | false" (5.5) language="javascript | jscript | vbs | vbscript" (4) unselectable="on | off" (5.5) HTML 4 Event Attributes onclick, ondblclick, onkeydown, onkeypress, onkeyup, onmousedown, onmousemove, onmouseout, onmouseover, onmouseup Please purchase PDF Split-Merge on www.verypdf.com to remove this watermark. C h a p t e r 3 : H T M L a n d X H T M L E l e m e n t R e f e r e n c e 333 C h a p t e r 3 : H T M L a n d X H T M L E l e m e n t R e f e r e n c e 333 PART I HTML5 Event Attributes onabort, onblur, oncanplay, oncanplaythrough, onchange, onclick, oncontextmenu, ondblclick, ondrag, ondragend, ondragenter, ondragleave, ondragover, ondragstart, ondrop, ondurationchange, onemptied, onended, onerror, onfocus, onformchange, onforminput, oninput, oninvalid, onkeydown, onkeypress, onkeyup, onload, onloadeddata, onloadedmetadata, onloadstart, onmousedown, onmousemove, onmouseout, onmouseover, onmouseup, onmousewheel, onpause, onplay, onplaying, onprogress, onratechange, onreadystatechange, onscroll, onseeked, onseeking, onselect, onshow, onstalled, onsubmit, onsuspend, ontimeupdate, onvolumechange, onwaiting Events Defined by Internet Explorer onactivate, onbeforedeactivate, onbeforeeditfocus, onblur, oncellchange, onclick, oncontrolselect, ondataavailable, ondatasetchanged, ondatasetcomplete, ondblclick, ondeactivate, ondrag, ondragend, ondragenter, ondragleave, ondragover, ondragstart, ondrop, onerror, onfocus, onkeydown, onkeypress, onkeyup, onlosecapture, onmove, onmoveend, onmovestart, onpropertychange, onreadystatechange, onresize, onresizeend, onresizestart, onrowenter, onrowexit, onrowsdelete, onrowsinserted, onscroll, onselectstart Element-Specific Attributes align This attribute aligns the object with respect to the surrounding text. The default is left. The HTML specification defines bottom, middle, right, and top, as well. Browsers might provide an even richer set of alignment values. The behavior of alignment for objects is similar to images. Under the strict HTML and XHTML specifications, the object element does not support this attribute. archive This attribute contains a URL for the location of an archive file. An archive file typically is used to contain multiple object files to improve the efficiency of access. border This attribute specifies the width of the object’s borders, in pixels or as a percentage. classid This attribute contains a URL for an object’s implementation. The URL syntax depends upon the object’s type. With ActiveX controls, the value of this attribute does not appear to be a URL but something of the form CLSID: object-id; for example, CLSID: 99B42120-6EC7-11CF-A6C7-00AA00A47DD2 . code Under the old Microsoft implementation, this attribute contains the URL referencing a Java applet class file. The way to access a Java applet under the HTML/XHTML specification is to use <object classid="java: classname.class">. The pseudo-URL java: is used to indicate a Java applet. Microsoft Internet Explorer 4 and beyond support this style, so code should not be used. codebase This attribute contains a URL to use as a relative base to access the object specified by the classid attribute. codetype This attribute specifies an object’s MIME type. Do not confuse this attribute with type, which specifies the MIME type of the data the object may use, as defined by the data attribute. Please purchase PDF Split-Merge on www.verypdf.com to remove this watermark. 334 P a r t I : C o r e M a r k u p 334 P a r t I : C o r e M a r k u p data This attribute contains a URL for data required by an object. declare This attribute declares an object without instantiating it. This is useful when the object will be a parameter to another object. In traditional HTML, this attribute takes no value; under XHTML, set it equal to declare. name Under the older forms of HTML, this attribute defines the name of the control so that scripting can access it. The id attribute should be used if possible. standby This attribute contains a text message to be displayed while the object is loading. type This attribute specifies the MIME type for the object’s data. This is different from codetype, which is the MIME type of the object and not of the data it uses. usemap This attribute contains the URL of the image map to be used with the object. Typically, the URL will be a fragment identifier referencing a map element somewhere else within the file. The presence of this attribute indicates that the type of object being included is an image. vspace This attribute indicates the vertical space, in pixels or as a percentage, between the object and surrounding text. Examples <! Using XHTML syntax with trailing slashes here > <object id="IeLabel1" width="325" height="65" classid="CLSID:99B42120-6EC7-11CF-A6C7-00AA00A47DD2"> <param name="_ExtentX" value="6879" /> <param name ="_ExtentY" value="1376" /> <param name="Caption" value="Hello World" /> <param name="Alignment" value="4" /> <param name="Mode" value="1" /> <param name="ForeColor" value="#FF0000" /> <param name="FontName" value="Arial" /> <param name="FontSize" value="36" /> <b>Hello World for non-ActiveX users!</b> </object> <! Standard HTML style > <object classid="java:Blink.class" standby="Here it comes" height="100" width="300"> <param name="lbl" value="Java is fun, exciting, and new."> <param name="speed" value="2"> This will display in non-Java-aware or -enabled browsers. </object> <! pulls in remote content here > <object data="pullinthisfile.html"> Data not included! </object> Please purchase PDF Split-Merge on www.verypdf.com to remove this watermark. C h a p t e r 3 : H T M L a n d X H T M L E l e m e n t R e f e r e n c e 335 C h a p t e r 3 : H T M L a n d X H T M L E l e m e n t R e f e r e n c e 335 PART I Compatibility HTML 4, 4.01, 5 XHTML 1.0, 1.1, Basic Firefox 1+, Internet Explorer 3+, Netscape 4+, Opera 4+, Safari 1+ Notes • Under the strict HTML and XHTML specifications, the object element loses most of its presentation attributes, including align, border, height, hspace, vspace, and width. These attributes are replaced by style sheet rules. • The HTML 4.01 specification reserves the datafld, dataformatas, and datasrc attributes for future use. However, these attributes were dropped in XHTML, though they are well supported by Internet Explorer 4 and beyond. • Alternative content should be defined within an <object> tag after any enclosed <param> tags. • The object element is still mainly used to include multimedia binaries in pages. Although the specification defines that it can load in HTML files, insert a variety of other objects, and create image maps, not every browser supports this, and few developers are aware of these features. In theory, this very versatile tag should take over duties from the venerable <img> tag in future specifications, though given the media-specific element trends of HTML5, this seems unlikely to happen. <ol> (Ordered List) This element is used to define an ordered or numbered list of items. The numbering style comes in many forms, including letters, Roman numerals, and regular numerals. The individual items within the list are specified by li elements included with the ol element. Standard Syntax <ol class="class name(s)" compact="compact" (transitional only) dir="ltr | rtl" id="unique alphanumeric identifier" lang="language code" start="number" (transitional versions and HTML5) style="style information" title="advisory text" type="a | A | i | I | 1"> (transitional only)> li elements only </ol> Attributes Introduced by HTML5 accesskey="spaced list of accelerator key(s)" contenteditable="true | false | inherit" contextmenu="id of menu" data-X="user-defined data" Please purchase PDF Split-Merge on www.verypdf.com to remove this watermark. [...]... contains the parameter’s name The name of the parameter depends on the particular object being inserted into the page, and it is assumed that the object knows how to handle the passed data Do not confuse the name attribute for this element with the name attribute used for form elements In the latter case, the name attribute does not have a similar meaning to id, but rather specifies the name of the data... XHTML specifications state that only the , , , , , and tags should not be used within the tag The other excluded elements are missing, as they are deprecated from the strict specification Although these elements should not be used, it appears that the more popular browsers will render them anyway • The strict HTML and XHTML specifications drop support for the. .. selected This attribute indicates that the associated item is the default selection If this attribute is not included, the first item in the selection list is the default If the select element enclosing the option elements has the multiple attribute, the selected attribute might occur in multiple entries Otherwise, it should occur in only one entry Under XHTML, the value of the selected attribute must be set... some HTML markup is allowed within the <PRE> element Compatibility HTML 2, 3.2, 4, 4.01, 5 XHTML 1.0, 1.1, Basic Firefox 1+, Internet Explorer 2+, Netscape 1+, Opera 4+, Safari 1+ Notes • The HTML 4.01 and XHTML 1.0 transitional specifications state that the applet, basefont, big, font, img, object, small, sub, and sup elements should not be used within a tag The strict HTML. .. that the list should be rendered in a compact style Few browsers actually change the rendering of the list, regardless of the presence of this attribute The compact attribute requires no value under traditional HTML but under XHTML should be set to compact Chapter 3: HTML and XHTML Element Reference start This attribute specifies the start value for numbering the individual list items Although the. .. Compatibility HTML 2, 3.2 4, 4.01, 5 XHTML 1.0, 1.1, Basic Firefox 1+, Internet Explorer 2+, Netscape 1+, Opera 2.1+, Safari 1+ Notes • Under HTML specifications, the closing tag for is optional However, for XHTML compatibility, the closing tag is required • This element should occur only within the context of a select element • The HTML 2.0 and 3.2 specifications define only the selected... tag type When the valuetype attribute is set to ref, the type attribute can be used to indicate the type of information to be retrieved Legal values for this attribute are in the form of MIME types, such as text /html value This attribute contains the parameter’s value The actual content of this attribute depends on the object and the particular parameter being passed in, as determined by the name attribute... Notes • The HTML 3.2 specification supports only the name and value attributes for this element • As an empty element under XHTML or when using XML-style syntax for HTML5 , a trailing slash is required for this element: (Plain Text) This deprecated element from the HTML 2.0 specification renders the enclosed text as plain text and forces the browser to ignore any enclosed HTML Typically,... should be set to the width of the preformatted region The value of the attribute should be the number of characters to display In practice, this attribute is not supported and is dropped under the strict HTML 4.01 specification wrap In some versions of Microsoft browsers, this attribute controls word wrap behavior within a tag The default value of off for the attribute forces the element not to... I reversed This HTML5 Boolean attribute specifies that the counting of the list should go in reverse order CSS counters provide much more functionality than this attribute, but it is useful in the absence of this more complicated syntax 337 338 Part I: Core Markup • HTML5 returns the start attribute to ordered lists and adds the reversed attribute • Under the XHTML 1.0 specification, the compact attribute . onwaiting Example <nav> <ul> <li><a href="about .html& quot;>About</a></li> <li><a href="services .html& quot;>Services</a></li>. href="services .html& quot;>Services</a></li> <li><a href="contact .html& quot;>Contact</a></li> <li><a href="index .html& quot;>Home</a></li>

Ngày đăng: 21/01/2014, 09:20

Từ khóa liên quan

Mục lục

  • 0071496297

  • Contents

  • Acknowledgments

  • Introduction

  • Part I: Core Markup

    • 1 Traditional HTML and XHTML

      • First Look at HTML and XHTML

      • Hello HTML and XHTML World

      • HTML and XHTML: Version History

      • HTML and XHTML DTDs: The Specifications Up Close

      • (X)HTML Document Structure

      • Browsers and (X)HTML

      • The Rules of (X)HTML

      • Major Themes of (X)HTML

      • The Future of Markup—Two Paths?

      • Summary

      • 2 Introducing HTML5

        • Hello HTML5

        • Loose Syntax Returns

        • XHTML5

        • HTML5: Embracing the Reality of Web Markup

        • Presentational Markup Removed and Redefined

        • HTML5 Document Structure Changes

Tài liệu cùng người dùng

  • Đang cập nhật ...

Tài liệu liên quan