📄 intro.html
字号:
text, and you may want to display the author's name in italic:</P><PRE class="example">INSTRUMENT { display: inline }ARTICLE, HEADLINE, AUTHOR, PARA { display: block }HEADLINE { font-size: 1.3em }AUTHOR { font-style: italic }ARTICLE, HEADLINE, AUTHOR, PARA { margin: 0.5em }</PRE><P>A visual user agent could format the above example as:<div class="figure"><p><img src="images/bach2.gif" alt="Example rendering"><SPAN class="dlink"> <A name="img-bach2" href="images/longdesc/bach2-desc.html" title="Long description for the second Bach/XML formatting example">[D]</A></SPAN></div><P>Adding more rules to the style sheet will allow you to furtherimprove the presentation of the document. <H2>2.3 <a name="processing-model">The CSS2 processing model</a></H2><P>This section presents one possible model of how useragents that support CSS work. This is only a conceptual model; realimplementations may vary.<P>In this model, a user agent processes a sourceby going through the following steps:</P><ol><li>Parse the source document and create a <ahref="conform.html#doctree">document tree</a>.</li><li>Identify the target <a href="media.html">media type</a>.<li>Retrieve all style sheets associated with the document that arespecified for the target <a href="media.html">media type</a>.<li>Annotate every element of the document tree by assigning a singlevalue to every <a href="syndata.html#properties">property</a> that isapplicable to the target <a href="media.html">media type</a>.Properties are assigned values according to the mechanisms describedin the section on <a href="cascade.html">cascading andinheritance</a>. <P>Part of the calculation of values depends on the formattingalgorithm appropriate for the target <a href="media.html">mediatype</a>. For example, if the target medium is the screen, user agentsapply the <a href="visuren.html">visual formatting model</a>. If thedestination medium is the printed page, user agents apply the <ahref="page.html#page-model">page model</a>. If the destination mediumis an aural rendering device (e.g., speech synthesizer), user agentsapply the <a href="aural.html">aural rendering model</a>.<li>From the annotated document tree, generate a <span class="index-def" title="formatting structure"><a name="formatting-structure"><dfn>formattingstructure</dfn></a></span>. Often, the formatting structure closelyresembles the document tree, but it may also differ significantly,notably when authors make use of pseudo-elements and generated content.First, the formatting structure need not be "tree-shaped" at all -- thenature of the structure depends on the implementation. Second, theformatting structure may contain more or less information than thedocument tree. For instance, if an element in the document tree has avalue of 'none' for the <a href="visuren.html#propdef-display" class="noxref"><spanclass="propinst-display">'display'</span></a> property, that element willgenerate nothing in the formatting structure. A list element, on theother hand, may generate more information in the formatting structure:the list element's content and list style information (e.g., a bulletimage).<P>Note that the CSS user agent does not alter the document treeduring this phase. In particular, content generated due to stylesheets is not fed back to the document language processor (e.g., forreparsing).<li>Transfer the formatting structure to the target medium (e.g., printthe results, display them on the screen, render them as speech,etc.).</ol><P>Step 1 lies outside the scope of this specification (see, forexample, <a href="refs.html#ref-DOM" rel="biblioentry" class="noxref"><span class="informref">[DOM]</span></a>).<P>Steps 2-5 are addressed by the bulk of this specification.<P>Step 6 lies outside the scope of this specification.</p><h3><a name="q4">2.3.1 The canvas</a></h3><P>For all media, the term <span class="index-def" title="canvas"> <aname="canvas"><dfn>canvas</dfn></a></span> describes "the space wherethe formatting structure is rendered." The canvas is infinite for eachdimension of the space, but rendering generally occurs withina finite region of the canvas, established by the user agentaccording to the target medium. For instance, user agents renderingto a screen generally impose a minimum width and choose an initialwidth based on the dimensions of the <a href="visuren.html#viewport">viewport</a>. User agents rendering to a page generally imposewidth and height constraints. Aural user agents may impose limitsin audio space, but not in time. <h3><a name="q5">2.3.2 CSS2 addressing model</a></h3><P> CSS2 <a href="selector.html">selectors</a> and properties allowstyle sheets to refer to the following parts of a documentor user agent:</p><ul><li>Elements in the document tree and certain relationships betweenthem (see the section on <a href="selector.html">selectors</a>).<li>Attributes of elements in the document tree, and values of thoseattributes (see the section on <ahref="selector.html#attribute-selectors">attribute selectors</a>).<li>Some parts of element content (see the <ahref="selector.html#first-line">:first-line</a> and <ahref="selector.html#first-letter">:first-letter</a> pseudo-elements.<li>Elements of the document tree when they are in a certain state(see the section on <a href="selector.html#pseudo-classes">pseudo-classes</a>).<li>Some aspects of the <a href="#canvas">canvas</a> wherethe document will be rendered.<li>Some system information (see the section on <a href="ui.html">userinterface</a>).</ul><H2><a name="q6">2.4 CSS design principles</a></H2><P>CSS2, as CSS1 before it, is based on a set of design principles:</p><UL><LI><P><STRONG>Forward and backward compatibility</STRONG>. CSS2 useragents will be able to understand CSS1 style sheets. CSS1 user agentswill be able to read CSS2 style sheets and discard parts they don'tunderstand. Also, user agents with no CSS support will be able todisplay style-enhanced documents. Of course, the stylisticenhancements made possible by CSS will not be rendered, but allcontent will be presented.</P></LI><LI><P><STRONG>Complementary to structured documents</STRONG>. Stylesheets complement structured documents (e.g., HTML and XMLapplications), providingstylistic information for the marked-up text. It should be easy tochange the style sheet with little or no impact on the markup.</P></LI><LI><P><STRONG>Vendor, platform, and device independence</STRONG>. Stylesheets enable documents to remain vendor, platform, and deviceindependent. Style sheets themselves are also vendor and platformindependent, but CSS2 allows you to target a style sheet for a group ofdevices (e.g., printers).</P></LI><LI><P><STRONG>Maintainability</STRONG>. By pointing to style sheets fromdocuments, webmasters can simplify site maintenance and retainconsistent look and feel throughout the site. For example, ifthe organization's background color changes, only one file needs to bechanged.</P></LI><LI><P><STRONG>Simplicity</STRONG>. CSS2 is more complex than CSS1, butit remains a simple style language which is human readable andwritable. The CSS properties are kept independent of each other to thelargest extent possible and there is generally only one way to achieve acertain effect.</P></LI><LI> <P><STRONG>Network performance</STRONG>. CSS provides for compactencodings of how to present content. Compared to images or audiofiles, which are often used by authors to achieve certain renderingeffects, style sheets most often decrease the content size. Also,fewer network connections have to be opened which further increasesnetwork performance.</P> </LI><LI><P><STRONG>Flexibility</STRONG>. CSS can be applied to content inseveral ways. The key feature is the ability to cascade styleinformation specified in the default (user agent) style sheet, userstyle sheets, linked style sheets, the document head, and inattributes for the elements forming the document body.</P></LI><LI><P><STRONG>Richness</STRONG>. Providing authors with a rich set ofrendering effects increases the richness of the Web as a medium ofexpression. Designers have been longing for functionality commonlyfound in desktop publishing and slide-show applications. Some ofthe requested rendering effects conflict with device independence, butCSS2 goes a long way toward granting designers their requests.</P></LI><LI><P><STRONG>Alternative language bindings</STRONG>. The set of CSSproperties described in this specification form a consistentformatting model for visual and aural presentations. This formattingmodel can be accessed through the CSS language, but bindings to otherlanguages are also possible. For example, a JavaScript program maydynamically change the value of a certain element's <a href="colors.html#propdef-color" class="noxref"><spanclass="propinst-color">'color'</span></a> property.</P></LI><LI><P><STRONG>Accessibility</STRONG>. Several CSS features will make the Web more accessible to users with disabilities:</p><UL><LI>Properties to control font appearance allow authorsto eliminate inaccessible bit-mapped text images. <li>Positioning properties allow authors to eliminatemark-up tricks (e.g., invisible images) to force layout.<LI>The semantics of<tt>!important</tt> rules mean that users with particular presentation requirementscan override the author's style sheets.<li>The new 'inherit' value for all propertiesimproves cascading generality and allows foreasier and more consistent style tuning.<li>Improved media support, including media groups and the braille, embossed, and tty media types, will allow users andauthors to tailor pages to those devices.<LI>Aural properties give control over voice and audio output.<LI>The attributeselectors, 'attr()' function,and 'content' property give access to alternate content.<LI>Counters and section/paragraph numbering can improvedocument navigability and save on indenting spacing(important for braille devices). The 'word-spacing' and'text-indent' properties also eliminate the needfor extra whitespace in the document.</UL><div class="note"><P> <em><strong>Note.</strong> For more informationabout designing accessible documents using CSS and HTML, pleaseconsult <a href="refs.html#ref-WAI-PAGEAUTH" rel="biblioentry" class="noxref"><span class="informref">[WAI-PAGEAUTH]</span></a>.</em></div></UL><hr class="navbar"><div class="navbar" align="center"><p><a href="about.html">previous</a> <a href="conform.html">next</a> <a href="cover.html#minitoc">contents</a> <a href="propidx.html">properties</a> <a href="indexlist.html">index</a> </div></BODY></HTML>
⌨️ 快捷键说明
复制代码
Ctrl + C
搜索代码
Ctrl + F
全屏模式
F11
切换主题
Ctrl + Shift + D
显示快捷键
?
增大字号
Ctrl + =
减小字号
Ctrl + -