Friday, 13 November 2009

Exercise 3.6 -- CSS

This week, I learned about the Document Object Model (DOM), a W3C standard which lets programmers manipulate XML and HTML documents by incorporating scripting languages. This allows for dynamic documents wihch are cross-browser compatible (W3C, 2004). I then learned about Cascading Style Sheets (CSS), used to separate the presentational elements of an HTML document from its structure. Styles can be included within documents, but linking to an external document is preferable as the advantages of CSS can be fully exploited. Part of this week's exercise entailed applying presentational elements to my web page using CSS, and my examples are available from http://www.student.city.ac.uk/~abgy261/css.html.

When accessed for the first time, a copy of the CSS is saved in the browser's cache; this saves bandwidth if subsequent files using the CSS are accessed. A CSS includes all the presentational elements, so the size of the HTML document may be reduced. Global changes can be made from a single document, saving authors time and allowing consistency. When creating web pages at work, I apply the default style sheet so my page fits with Leeds University Library's overall look and feel. CSS documents also improve accessibility, for example including styles for screen readers, mobile devices and a style to correctly render a document for printing. Unfortunately, a CSS only tells the browser how information should be displayed. Browsers do not adhere to the rules, so as with all web documents, it is crucial to check the presentation on a variety of browsers and use a tool like the W3C's validator.

A CSS can be used to format XML documents. Learning how to do this was beyond the scope of the lectures, although I learned that the W3C recommends XSLT (XSL Transformations) for this purpose as it is more extensive and extensible, although current browser support for this technology is poor (W3C, 2009b).

No comments:

Post a Comment