/[suikacvs]/webroot/www/2004/id/draft-ietf-html-style-01.txt
Suika

Contents of /webroot/www/2004/id/draft-ietf-html-style-01.txt

Parent Directory Parent Directory | Revision Log Revision Log


Revision 1.1 - (show annotations) (download)
Tue Jun 15 08:04:04 2004 UTC (19 years, 11 months ago) by wakaba
Branch: MAIN
CVS Tags: HEAD
File MIME type: text/plain
New

1
2 HTML and Style Sheets 23 Jan 96
3
4 INTERNET DRAFT Bos, Raggett & Lie,
5 Expires in six months World Wide Web Consortium
6
7 HTML and Style Sheets
8
9 <draft-ietf-html-style-01.txt>
10
11 Status of this Memo
12
13 This document is an Internet draft. Internet drafts are working
14 documents of the Internet Engineering Task Force (IETF), its areas
15 and its working groups. Note that other groups may also distribute
16 working information as Internet drafts.
17
18 Internet Drafts are draft documents valid for a maximum of six
19 months and can be updated, replaced or obsoleted by other documents
20 at any time. It is inappropriate to use Internet drafts as reference
21 material or to cite them as other than as "work in progress".
22
23 To learn the current status of any Internet draft please check the
24 "lid-abstracts.txt" listing contained in the Internet drafts shadow
25 directories on ftp.is.co.za (Africa), nic.nordu.net (Europe),
26 munnari.oz.au (Pacific Rim), ds.internic.net (US East coast) or
27 ftp.isi.edu (US West coast). Further information about the IETF can
28 be found at URL: http://www.ietf.org/
29
30 Distribution of this document is unlimited. Please send comments to
31 the HTML working group (HTML-WG) of the Internet Engineering Task
32 Force (IETF) at <html-wg@w3.org>. Discussions of this group are
33 archived at URL: http://www.acl.lanl.gov/HTML-WG/archives.html.
34
35 This specification is also available via the Web in hypertext form
36 as a Working Draft of the World Wide Web Consortium, see:
37 http://www.w3.org/pub/WWW/TR
38
39 Authors:
40 Bert Bos <bert@w3.org>,
41 Dave Raggett <dsr@w3.org>,
42 Hakon Lie <howcome@w3.org>
43
44 ------------------------------------------------------------------------------
45 Abstract
46
47 The HyperText Markup Language (HTML) is a simple markup language
48 used to create hypertext documents that are portable from one
49 platform to another. HTML documents are SGML documents with generic
50 semantics that are appropriate for representing information from a
51 wide range of applications. This specification extends HTML to
52 provide support for style rules expressed in separately specified
53 notations. It is no longer necessary to extend HTML when new styles
54 are needed. Style rules can be (a) included with individual HTML
55 elements to which they apply, (b) grouped together in the document
56 head, or (c) placed in associated style sheets. This specification
57
58 Bos, Raggett & Lie Page 1
59
60
61
62 HTML and Style Sheets 23 Jan 96
63
64 does not specify particular style sheet notations, leaving that to
65 other specifications.
66
67 Contents
68
69 * Associating HTML documents with style sheets ...................... 2
70
71 * Media dependencies ................................................ 3
72
73 * The LINK element .................................................. 3
74
75 * The STYLE element ................................................. 4
76
77 * Common attributes ................................................. 5
78
79 * The SPAN element .................................................. 7
80
81 * The DIV element ................................................... 7
82
83 * User interface and user supplied style sheets
84
85 * Performance issues ................................................ 9
86
87 * Limitations of this specification ................................. 9
88
89 * References ....................................................... 10
90
91 Associating HTML documents with Style Sheets
92
93 There are several approaches for associating HTML documents with
94 separate style sheets:
95
96 User applied style sheets
97 The user agent may provide the means for users to select and
98 apply style sheets.
99
100
101
102 Implicit associations
103 The appropriate style sheet may be implied by the URL or other
104 information describing the resource. This approach allows style
105 sheets to be retrieved in advance of, or at the same time as,
106 the HTML document itself. Implicit associations are not defined
107 in this report.
108
109
110
111 Explicit associations
112 The author can specify one or more alternative style sheets for
113 an HTML document using one of the methods described below.
114
115
116
117
118 Bos, Raggett & Lie Page 2
119
120
121
122 HTML and Style Sheets 23 Jan 96
123
124 In HTML it is also possible to put style sheets in-line in the
125 document. HTML is extended with a new element and a new attribute
126 (both called STYLE), as described below. No matter how style is
127 associated with HTML, the user should be made aware that a
128 particular style has been applied and should have the option of
129 turning it off.
130
131 To make it easier to apply a style to parts of a document, two new
132 elements for use in the body of an HTML document are defined: DIV
133 and SPAN. The first is to enclose a division (chapter, section,
134 etc.) of a document, making it possible to give a whole section a
135 distinctive style. The latter is used within paragraphs, similarly
136 to EM, but in cases where none of the other HTML elements (EM,
137 STRONG, VAR, CODE, etc.) apply.
138
139 Media dependencies
140
141 Styles may often be designed for a restricted range of media, e.g.
142 for graphical user interfaces with scalable fonts and millions of
143 colors; for A4 paper media; for speech output; or for simple
144 terminals with one monospace font. This proposal doesn't provide an
145 explicit means to state the conditions under which a given style
146 sheet is applicable.
147
148 Style sheet notations may themselves provide support for media
149 dependencies. Another approach is to use a generic URL to reference
150 a style sheet, and to make the binding to a specific URL according
151 to the media required. This will be described in a separate working
152 draft.
153
154 The LINK element
155
156 In HTML, the LINK element is used to create a typed hyperlink
157 between the document and some other resource. The REL attribute
158 defines the type of the link. With REL=stylesheet, the LINK element
159 can also be used to link to a style sheet.
160
161 Authors can use LINK elements to offer readers a choice of style
162 sheets, e.g:
163
164 <LINK TITLE="Old" REL=stylesheet HREF="old.style" TYPE="application/dsssl">
165 <LINK TITLE="New" REL=stylesheet HREF="new.style" TYPE="application/rtf">
166 <LINK TITLE="Wacky" REL=stylesheet HREF="wacky.style" TYPE="text/css">
167 <TITLE>ACME Widgets Corp</TITLE>
168
169 <H1>ACME Widgets Corp</H1>
170 <P>If your browser supports style sheets, try our new look
171 in old, new and wacky styles.
172
173 ...
174
175 This specification builds upon the definition of the LINK element in
176 HTML 2.0 (RFC 1866) in the following respects:
177
178 Bos, Raggett & Lie Page 3
179
180
181
182 HTML and Style Sheets 23 Jan 96
183
184 <!ELEMENT LINK - O EMPTY>
185 <!ATTLIST LINK
186 href CDATA #REQUIRED -- Uniform Resource Locator --
187 title CDATA #IMPLIED -- advisory title string --
188 rel CDATA #IMPLIED -- forward link type --
189 rev CDATA #IMPLIED -- reverse link type --
190 type CDATA #IMPLIED -- advisory Internet media type --
191 >
192
193 * The forward link type "stylesheet" is hereby defined to signify
194 that the associated LINK element specifies a link to a style
195 sheet that may be applied to the HTML document containing the
196 LINK element. The HREF attribute specifies the network address
197 of the linked style sheet.
198
199 * If there are several such links, then these are considered as
200 providing a choice of alternative style sheets. The character
201 string supplied with the TITLE attribute is recommended for use
202 in building a menu of alternative styles. Note that the order of
203 such LINK elements in the document markup does not signify
204 preference order.
205
206 * The TYPE attribute may be used to specify the Internet Media
207 type and associated parameters for the linked style sheet. This
208 allows the user agent to disregard style sheets in unsupported
209 notations, without the need to first make a remote query across
210 the network.
211
212 The STYLE element
213
214 A single STYLE element may be included in the document head. It
215 allows authors to include style rules within the HTML document, e.g.
216
217 <HEAD>
218 <TITLE>Title</TITLE>
219 <STYLE TYPE="text/css">
220 H1 { color: brown }
221 P { color: blue }
222 </STYLE>
223 </HEAD>
224
225 The STYLE element is formally defined by:
226
227 <!ELEMENT style - O (#PCDATA)>
228 <!ATTLIST style
229 type CDATA #REQUIRED -- Internet media type for style --
230 title CDATA #IMPLIED -- advisory title for this style --
231 >
232
233 The attributes are defined as follows:
234
235
236
237
238 Bos, Raggett & Lie Page 4
239
240
241
242 HTML and Style Sheets 23 Jan 96
243
244 TYPE
245 This required attribute defines the style notation as an
246 Internet Media type including associated parameters. It is used
247 in the same way as with LINK elements. The type applies to style
248 rules in the STYLE element as well as those attached with the
249 STYLE attribute.
250
251
252
253 TITLE
254 The user agent is recommended to use the title string when
255 building a menu of alternative style sheets. This will only
256 happen if the STYLE element occurs together with linked style
257 sheets as specified by one or more LINK elements. In the absence
258 of such LINK elements, the TITLE attribute may be used to
259 describe the style sheet for the purpose of allowing the user to
260 turn style sheets on and off.
261
262
263
264 The content model for the STYLE element precludes SGML tags, and the
265 end tag of a STYLE element can usually be omitted, e.g. when the
266 STYLE element is followed by another element. Some characters may
267 require escaping with their SGML entity names: "&" followed by a
268 letter or "#" character should be represented by "&" while "<"
269 followed by a letter, "!" or "?" character should be represented by
270 "<".
271
272 When the STYLE element occurs together with one or more LINK
273 elements that specify linked style sheets, the user agent should
274 consider the STYLE element in preference to the LINK elements. The
275 rendering implied by the STYLE element is independent of such LINK
276 elements, i.e. it is not cascaded with style sheets specified by
277 LINK elements.
278
279 Common attributes
280
281 To support effective use of style sheets with HTML documents a
282 number of common attributes are proposed. These can be used with
283 most HTML elements. In general, all attribute names and values in
284 this specification are case insensitive, except where noted
285 otherwise.
286
287
288 <!ENTITY % attrs
289 "id ID #IMPLIED -- element identifier --
290 class NAMES #IMPLIED -- for subclassing elements --
291 style CDATA #IMPLIED -- rendering annotation --
292 lang NAME #IMPLIED -- as per RFC 1766 --
293 dir (ltr|rtl) #IMPLIED -- I18N text direction --">
294
295
296
297
298 Bos, Raggett & Lie Page 5
299
300
301
302 HTML and Style Sheets 23 Jan 96
303
304 ID
305 Used to define a document-wide identifier. This can be used for
306 naming positions within documents as the destination of a
307 hypertext link. It may also be used by style sheets for
308 rendering an element in a unique style. An ID attribute value is
309 an SGML NAME token. NAME tokens are formed by an initial letter
310 followed by letters, digits, "-" and "." characters. The letters
311 are restricted to A-Z and a-z.
312
313 CLASS
314 A space separated list of SGML NAME tokens. CLASS names specify
315 that the element belongs to the corresponding named classes.
316 These may be used by style sheets to provide class dependent
317 renderings.
318
319 STYLE
320 A text string providing rendering information specific to this
321 element. The notation is specified with the STYLE element in the
322 document head.
323
324 For example:
325
326 <TITLE>Test Document</TITLE>
327 <STYLE TYPE="text/css">
328 <P STYLE="color: red; font-style: small-caps">This text should
329 be in small capitals and colored red!
330
331 The end tag for the STYLE element has been omitted here since
332 the element is unambiguously ended by the <P> start tag.
333
334
335
336 LANG
337 A LANG attribute identifies the natural language used by the
338 content of the associated element.The syntax and registry of
339 language values are defined by RFC 1766. In summary the language
340 is given as a primary tag followed by zero or more subtags,
341 separated by "-". White space is not allowed and all tags are
342 case insensitive. The name space of tags is administered by
343 IANA. The two letter primary tag is an ISO 639 language
344 abbreviation, while the initial subtag is a two letter ISO 3166
345 country code. Example values for LANG include:
346
347 en, en-US, en-uk, i-cherokee, x-pig-latin.
348
349 DIR
350 Human writing systems are grouped into scripts, which determine
351 amongst other things, the direction the characters are written.
352 Elements of the Latin script are nominally left to right, while
353 those of the Arabic script are nominally right to left. These
354 characters have what is called strong directionality. Other
355 characters can be directionally neutral (spaces) or weak
356 (punctuation).
357
358 Bos, Raggett & Lie Page 6
359
360
361
362 HTML and Style Sheets 23 Jan 96
363
364 The DIR attribute specifies an encapsulation boundary which
365 governs the interpretation of neutral and weakly directional
366 characters. It does not override the directionality of strongly
367 directional characters. The DIR attribute value is one of LTR
368 for left to right, or RTL for right to left, e.g. DIR=RTL.
369
370 The SPAN element
371
372 <!ELEMENT span O O (%text)*>
373 <!ATTLIST span
374 %attrs; -- id, class, style, lang and dir --
375 >
376
377 Sometimes it is desirable to apply a style to some text which
378 doesn't have a structural role or established rendering convention.
379 For instance, the first few words of an article may be rendered as
380 small capital letters ("small-caps"). In such situations it is
381 inappropriate to use an existing tag such as EM: on existing user
382 agents the first few words would be mysteriously italicized. The new
383 SPAN tag is recommended instead, as it has no effect on existing
384 user agents.
385
386 An example based on CSS:
387
388 <TITLE>Title</TITLE>
389 <STYLE TYPE="text/css">
390 SPAN { font-style: small-caps }
391 </STYLE>
392 <P><SPAN>The first</SPAN> few words of this
393 article is in small-caps.
394
395 This would be formatted to look something like:
396
397 THE FIRST few words of this
398 article is in small-caps.
399
400 While on an existing user agent it would look like:
401
402 The first few words of this
403 article is small-caps.
404
405
406 The SPAN element can be used anywhere that the HTML EM element is
407 allowed.
408
409 The DIV element
410
411 <!ELEMENT div - - (%body.content)*>
412 <!ATTLIST div
413 %attrs; -- id, class, style, lang and dir --
414 align (left|center|right|justify) #IMPLIED
415 >
416
417
418 Bos, Raggett & Lie Page 7
419
420
421
422 HTML and Style Sheets 23 Jan 96
423
424 The DIV element is used with the CLASS attribute to represent
425 different kinds of containers, e.g. chapter, section, abstract, or
426 appendix. DIV allows the enclosed group of elements to be given a
427 distinctive style. For example:
428
429 <DIV CLASS=Abstract>
430 <P>The Chieftain product range is the white-hot hope for the
431 coming year. This report sets out how to position Chieftain
432 against competing products.
433
434 <P>Chieftain replaces the Commander range, which will
435 remain on the price list until further notice.
436 </DIV>
437
438 The DIV element can be used anywhere that the HTML P element is
439 allowed. The content model for DIV allows headers, lists, paragraphs
440 as well as other DIV elements etc. This allows DIVs to be nested, to
441 form hierarchies of chapters, sections, and subsections etc.
442
443 DIV can be used with an ALIGN attribute to specify the default
444 horizontal alignment for the contents of the DIV element. This is
445 needed for compatibility with deployed browsers and may be overriden
446 by style sheets.
447
448 ALIGN=LEFT
449 Lines are aligned flush left
450
451 ALIGN=CENTER
452 Lines are centered.
453
454 ALIGN=RIGHT
455 Lines are aligned flush right
456
457 ALIGN=JUSTIFY
458 Lines are justified where practical, otherwise this has the same
459 effect as ALIGN=LEFT
460
461 User interface and user supplied style sheets
462
463 In an interactive user agent, the user should be made aware that a
464 particular style sheet has been applied, and be given the option of
465 turning it off or selecting a different style. A flag in the corner
466 of the window and a toggle in a menubar can be sufficient.
467
468 It may be possible for the user to combine several of the available
469 style sheets. It should be possible for the user to choose a
470 personal style instead of, or in combination with, style sheets
471 supplied by the author.
472
473 When a user agent applies a style sheet to a document while the
474 author of that document has indicated a preference for a different
475 style sheet, the user agent may have to alert the user to that fact.
476 Exactly how and when that is done is outside the scope of this
477
478 Bos, Raggett & Lie Page 8
479
480
481
482 HTML and Style Sheets 23 Jan 96
483
484 report. E.g., the CSS style sheet language gives rules for the
485 conditions under which a user is allowed to override the author's choices.
486
487 Performance issues
488
489 Some people have voiced concerns over performance issues for style
490 sheets. For instance, fetching a LINKed style sheet may delay the
491 full presentation for the user. A similar situation arises if the
492 document head includes a lengthy set of style rules.
493
494 The current proposal sidesteps these issues by allowing authors to
495 include rendering instructions within each HTML element. The
496 rendering information is then always available by the time the user
497 agent wants to render each element.
498
499 In many cases, authors will take advantage of a common style sheet
500 for a group of documents. In this case, distributing style rules
501 throughout the document will actually lead to worse performance than
502 using a linked style sheet, since for most documents, the style
503 sheet will already be present in the local cache. The public
504 availability of good style sheets will encourage this effect.
505
506 Limitations of this specification
507
508 This specification limits the number of STYLE elements to one per
509 document. If later revisions allow multiple STYLE elements in the
510 document head (e.g. to cater for alternative styles) one will need a
511 different way of specifying the style notation for STYLE attributes
512 on the elements in the document body. The suggested choice is an
513 attribute on the BODY element, e.g. "styletype", with the same
514 definition as the "type" attribute for the STYLE element.
515
516 Also, there is no way to specify that two or more style sheet are to
517 be merged. A common case is where the style of a document is based
518 on an organization-wide style sheet (which is likely to be cached),
519 but needs document-specific overrides. This functionality may be
520 added in the future, but can also be provided by the style sheet
521 notation itself, e.g. in CSS one can specify:
522
523 <HEAD>
524 <TITLE>Title</TITLE>
525 <STYLE TYPE="text/css">
526 @import "house-style.css"
527 @import "draft-report.css"
528 H1 { color: red } /* override cascaded style sheets */
529 </STYLE>
530 </HEAD>
531
532
533
534
535
536
537
538 Bos, Raggett & Lie Page 9
539
540
541
542 HTML and Style Sheets 23 Jan 96
543
544 References
545
546 RFC 1866
547 "Hypertext Markup Language - 2.0" by T. Berners-Lee & D.
548 Connolly, November 1995. This document can be downloaded from
549 ftp://ds.internic.net/rfc/rfc1866.txt.
550
551 RFC 1766
552 "Tags for the Identification of Languages", by H. Alvestrand,
553 UNINETT, March 1995. This document can be downloaded from
554 ftp://ds.internic.net/rfc/rfc1766.txt.
555
556 CSS
557 "Cascading style sheets" by Hakon Lie & Bert Bos, December 1995.
558 The latest version of this document can be downloaded from
559 http://www.w3.org/pub/WWW/TR/WD-css1.html
560
561 ------------------------------------------------------------------------------
562 The World Wide Web Consortium: http://www.w3.org/
563
564
565
566
567
568
569
570
571
572
573
574
575
576
577
578
579
580
581
582
583
584
585
586
587
588
589
590
591
592
593
594
595
596
597
598 Bos, Raggett & Lie Page 10
599

admin@suikawiki.org
ViewVC Help
Powered by ViewVC 1.1.24