Phd Thesis: Cascading Style Sheets
Total Page:16
File Type:pdf, Size:1020Kb
Cascading Style Sheets Håkon Wium Lie Thesis submitted for the degree of Doctor Philosophiœ Faculty of Mathematics and Natural Sciences University of Oslo Norway 2005 © Håkon Wium Lie, 1994-2005 This work is licensed under a Creative Commons Attribution-NonCommercial 2.5 License. Submitted 29th of March, 2005, as partial fulfillment of the degree Doctor Philosophiœ At the Faculty of Mathematics and Natural Sciences University of Oslo Norway Series of dissertations submitted to the Faculty of Mathematics and Natural Sciences, University of Oslo. No. 498 ISSN 1501-7710 Cover: Inger Sandved Anfinsen. Printed in Norway: AiT e-dit AS, Oslo, 2006. Produced in co-operation with Unipub AS. The thesis is produced by Unipub AS merely in connection with the thesis defence. Kindly direct all inquiries regarding the thesis to the copyright holder or the unit which grants the doctorate. Unipub AS is owned by The University Foundation for Student Life (SiO) Abstract The topic of this thesis is style sheet languages for structured documents on the web. Due to characteristics of the web – including a screen-centric publishing model, a multitude of output devices, uncertain delivery, strong user preferences, and the possibility for later binding between content and style – the hypothesis is that the web calls for different style sheet languages than does traditional electronic publishing. Style sheet languages that were developed and used prior to the web are analyzed and compared with style sheet proposals for the web between 1993-1996. The dissertation describes the design of a web-centric style sheet language known as Cascading Style Sheets (CSS). CSS has several notable features including: cascading, pseudo-classes and pseudo-elements, forward-compatible parsing rules, support for different media types, and a strong emphasis on selectors. Problems in CSS are analyzed, and recommended future research is described. i Inspiration Style sheets constitute a wormhole into unspeakable universes. –James D Mason, 1994 Style sheet languages are terribly underresearched. –Philip M Marden, Ethan V Munson, 1999 In which form are you planning to publish the first edition of the Parsifal poem? Even if I like Latin letters, I'm afraid they are unpopular (especially among publishers). So, if the letters will be German, please make the type large and of good quality. The legibility of a text is very important to me. –Richard Wagner, in a letter to his publisher Ludwig Strecker iii Table of contents Abstract.............................................................................................................. i Inspiration ........................................................................................................ iii Table of contents...............................................................................................v List of figures .................................................................................................. xv List of tables.................................................................................................. xvii Acknowledgements ........................................................................................ xix Overview and summary of the thesis ........................................................... xxiii Chapter 1: Introduction ...................................................27 1.1 Structure versus presentation............................................................................27 1.1.1 Abstraction levels ....................................................................................28 1.1.2 Presentational HTML .............................................................................29 1.2 Style sheets..................................................................................................30 1.2.1 WYSIWYG – a competing model ...........................................................31 1.2.2 Web characteristics .................................................................................31 1.2.3 Style sheet mechanisms for the web .........................................................33 1.3 CSS ..........................................................................................................33 1.3.1 The CSS development ............................................................................34 1.4 Summary and conclusions...............................................................................35 Chapter 2: Structured documents .................................... 37 2.1 Abstraction levels ..........................................................................................38 2.2 Structured document systems............................................................................41 2.2.1 Scribe .....................................................................................................43 2.2.1.1 A simple document..................................................................................43 2.2.1.2 Document types......................................................................................44 2.2.1.3 Scribe commands.....................................................................................45 2.2.1.4 Formatting environments..........................................................................46 2.2.1.5 Changing and adding environments............................................................48 v 2.2.1.6 Scribe in context .....................................................................................49 2.2.2 LaTeX....................................................................................................50 2.2.3 Open Document Architecture (ODA).....................................................52 2.2.4 Standard Generalized Markup Language (SGML).....................................53 2.2.4.1 Document Type Definition (DTD)...........................................................54 2.2.4.2 Processing Instructions..............................................................................55 2.2.4.3 LINK..................................................................................................55 2.2.4.4 SGML in context...................................................................................57 2.2.5 HyperText Markup Language (HTML)...................................................58 2.2.5.1 HTML's original design ..........................................................................58 2.2.5.2 Structure versus style................................................................................59 2.2.5.3 HTML and SGML...............................................................................60 2.2.5.4 HTML+ and HTML3...........................................................................61 2.2.5.5 HTML 3.2 ..........................................................................................64 2.2.5.6 HTML 4 .............................................................................................64 2.2.5.7 HTML in context ..................................................................................65 2.2.6 XML......................................................................................................66 2.2.6.1 The SGML Working Group charter..........................................................66 2.2.6.2 The XML specification ............................................................................67 2.2.6.3 XML and style sheets ..............................................................................68 2.2.6.4 XML in context .....................................................................................69 2.3 The role of transformation languages .................................................................69 2.3.1 Adorning the tree....................................................................................70 2.3.2 Transforming the tree .............................................................................70 2.3.3 Formatting objects ..................................................................................71 2.3.4 Retaining both semantics and presentation...............................................72 2.3.5 Style versus transformation ......................................................................73 2.4 Summary and conclusions...............................................................................74 Chapter 3: Style sheets prior to the web...........................77 3.1 Components of a style sheet language ................................................................78 3.2 Formatting Output Specification Instance (FOSI) ..............................................80 3.2.1 Syntax ....................................................................................................82 3.2.2 Selectors .................................................................................................83 3.2.3 Properties ...............................................................................................84 3.2.4 Values and units......................................................................................86 vi Table of contents 3.2.5 Value propagation ...................................................................................87 3.2.6 Visual formatting model ..........................................................................88 3.2.7 Linking mechanism.................................................................................90 3.2.8 Generated content ..................................................................................90