Re: [CSS21] What does 'text-transform: capitalize' mean, exactly?

On Oct 21, 2008, at 6:40 AM, Tab Atkins Jr. wrote:
> On Tue, Oct 21, 2008 at 8:20 AM, Henrik Hansen <henrikb4@gmail.com>  
> wrote:
> Les Brown wrote:
> My dictionaries say that capitalize means "put ALL the text in  
> capitals"
> but I guess it's too late to change the spec.
>
> A capitalized text is where the first letter in every word is  
> uppercase, like this:
> The Quick Brown Fox Jumbed Over The Lazy Dog.
>
> No, Les definitely has a point.  I too refer to upcasing the first  
> letter of every word as "initial-caps", and my fingers always try  
> to type that out when I mean capitalize in a text-transform rule.   
> It's really not that important, though.

In English, 'capitalize' may mean one of several things. The most  
common usage is to make something a title, which has all sorts of  
complex rules about which words should have initial capitals and  
which ones should not. For the computer world, a second common usage  
is to make (what I have heard called 'AOL-SPEAK' ;-) ALL TEXT IN  
CAPS. Somewhere, further down the list is Initial Capitals, where ALL  
of the first letters are capitals, not just following the rules for  
capitalization in titles -- this is sometimes used when making  
acronyms, e.g., International Business Machines (IBM). Since there  
are use cases for each of these options, it would be nice to have the  
option to control them with CSS.

Recognizing that title-caps is a complex subject, I would have no  
problem deferring this for a later revision of the specification.

I would like to point out that 'text-transform:lowercase;' turns all  
letters to lowercase, so its (apparent) converse, 'text- 
transform:capitalize;' (or possibly 'text-transform:uppercase;')  
should do the opposite and make all letters into capitals. With the  
uppercase/lowercase key words, then 'capitalize' could reasonable  
mean either 'initial-caps' or 'title-caps'. But don't make the  
mistake of assuming that the word means one or the other without  
making that clear in the specification.

>
>
>
> Also, if a future version of the spec introduces a "capitalize-all"  
> text
> transformation, what should happen to camel-case text like "WebKit"?
>
> Now this raises an even bigger question.
>
> <span style="text-transform:lowercase">
>    TeX is a typesetting program made by Donald Knuth.
>    <span style="text-transform:capitalize">
>        Few people write in raw TeX, most do it in LaTeX
>    </span>
> </span>
>
> What will this render as?
>
> tex is a typesetting program made by donald knuth. Few People Write  
> In Raw Te?, Most Do It In La?e?
>
> What is the right way?
>
> Um, uppercase and lowercase are *already* valid text-transform  
> values.  You can just test these things yourself.  In the first  
> case (camelCased word being affected by uppercase) the word goes  
> uppercase, so you get WEBKIT rather than WebKit.  In the second,  
> the first sentence is entirely lowercased, while the first letters  
> of each word in the second sentence are capitalized, and additional  
> capitals later in the word are left as-is (because only one text- 
> transform value can be in effect at a time, and capitalize doesn't  
> have any effect on the rest of the words).
>
> ~TJ

Oops -- I should open my eyes more when I read. OK -- uppercase means  
ALL CAPS. Great. That only leaves the possibility of 'capitalize'  
being equivalent to 'title-caps' or to 'initial-caps'. And, of  
course, the problems with camel-cased words are resolved with upper/ 
lower case, since they are already defined to change all letters to  
either upper or lower case. And, initial-caps should only affect the  
first letters of each word.

That only leaves 'title-caps' to resolve, since some preferences  
exist to have the camelCase words should be rendered differently in  
titles.


</James>

Received on Tuesday, 21 October 2008 15:01:37 UTC