Re: Proposed ::last-line and ::last-letter selectors

Having committed the error of placing the data in the place reserved for the 
metadata and having had to find and fix the problems it caused often enough, I 
thought that I would have learned the lesson that CSS teaches -- separate 
semantics from style.

However, I have a few counter-points to that argument in this case.

First: the current pseudo-elements in CSS3 could (perhaps not easily) be made 
into regular elements. First-letter is simple, place a <span> around the first 
letter and apply styles to it. First-line might be a special case of a normal 
element, where CSS calculates the actual line and then applies formatting to 
that. An extension to CSS might even allow formatting based on the line number 
inside a paragraph or table cell. Selection, before, and after, could also be 
handled as a special format within certain elements which might require 
calculation of the actual positioning of the formatting in the display. (For 
example, an attribute could be defined that tells CSS to select some piece of 
the text and format that differently.)

Second: the examples proposed have to do with applying styles to existing text. 
If I were creating a web page from scratch and wanted the numbers formatted a 
particular way, I could type the numbers as I wished, then apply elements and 
styles as I wished. If I were collecting data (from a database, spreadsheet, 
other web page, scanned and OCR text, etc.) and creating the web page 'on the 
fly,' then applying styles to particular parts of the text becomes more problematic.

In summary: Recognizing the difficulties when semantics and style are mixed, I 
still think this is on the borderline and could be a useful ability in CSS. It 
could also make the current pseudo-elements easier to program and allow users a 
powerful tool to apply styles to parts of a document which don't have current 

 >>      If a number is negative, print it in red.
 >>      If a name (IBM) appears in a page, make the word's font larger and blue.
 >>      Display all (American) monetary values with a dollar sign ($), a decimal
 >> point (.) and cents ("$f8.2" for example).

 > These involve putting document semantics only into the style sheet.

 > Normally the problem one gets is attempts to putting things into the
 > HTML purely for presentational reasons, but, in this case, these
 > constructs should be explicitly marked up in the HTML if they are
 > important enough to justify special styling.  The negative number is
 > the most awkward, as one could argue that the semantic markup only
 > really needs to go as far as to indicate that this is a number, rather
 > than a digit string.

 > The negative number also demonstrates a  problem in doing this without
 > proper semantic markup, as -999 formats are often used as version
 > suffixes, and sometimes only the suffix is quoted.

Thank you for your thoughtful responses,

James Elmore
22162 Windward Way
Lake Forest, CA 92630
Home	(949) 830-9534

Received on Tuesday, 22 August 2006 20:36:39 UTC