Re: Initial Value

Felix Miata wrote:
> L. David Baron wrote Wed, 1 Jun 2005 13:55:33 +0200:
> 
>>On Wednesday 2005-06-01 02:40 -0400, Felix Miata wrote:
> 
>>>I think that the language here is both entirely clear and dictates a
>>>much better result (reset to initial value medium, then apply 70% to
>>>medium) than what you say the cascade demands (ignore initial value
> 
>>Boris has explained this pretty clearly already, but I'll restate that
>>you're clearly wrong.  Percentage values are defined to be percentages
>>of the parent element's font size.
>>http://www.w3.org/TR/CSS21/fonts.html#font-size-props says:
> 
> I have no problem with his explanation of how cascade is supposed to
> work. My problem is he fails to reconcile it with the plain language of
> 15.7 that clearly says ALL values are FIRST reset, which to me clearly
> means font-size is set to medium (in the 'font-size' list above
> "Percentages"), a size that is ostensibly immune to font-size
> inheritance of author and user stylesheet sizing. Once reset is
> performed, medium should stand in the stead of the value from the
> parent.

As others have already pointed out, you've understood this 
incorrectly. I'll explain this in programming terms, in hope that it 
makes it more clear.

We have two objects P and C and both have property font-size. They 
also have properties 'child' and 'parent'. P and C have following state:

P { font-size=x; parent=null; child=C;    }
C { font-size=y; parent=P;    child=null; }

Now, the CSS rule c { font: Times 70%; } FIRST resets all font 
related properties of C, including the font-size so the system sets 
C to state

C { font-size: medium; parent=P; child=null; }

THEN the system applies the setting "70%" to font-size as defined 
per CSS specification and we get following state for C:

C { font-size: 70%; parent=P; child=null; }

This is the final state unless there're more rules.

--

The actual rendering is performed with computed values and to get 
the computed value for the C's font-size property the system does 
the following:

Get C.font-size

Figure out that the C.font-size uses a percentage unit

Query the C.parent for it's *computed value* to calculate the 
computed size for C. The computed value of C.parent.font-size is x 
so we get (x * 0.70) as the computed value of C.font-size.


I hope this makes it easier to understand the algorithm.

If you do understand the algorithm and propose a change to it, 
please, say so. Currently it seems like you've misunderstood how 
this is supposed to work.

--
IIRC, a new unit called 'rem' (root element em) has been already 
proposed for this use. The (0.7 * medium) font-size you're after 
could be expressed as "0.7rem" if this unit were used. Another 
choice to get the same result might be to use the calc() syntax: 
font-size: calc(0.7 * medium) -- though I'm afraid that 'medium' 
isn't allowed symbol for calc().

-- 
Mikko

Received on Wednesday, 1 June 2005 14:13:56 UTC