Skip to content

Commit b1227ec

Browse files
committed
[css-fonts-4] Migrate font-size property from level 3
1 parent b0184cd commit b1227ec

File tree

1 file changed

+145
-1
lines changed

1 file changed

+145
-1
lines changed

css-fonts-4/Overview.bs

Lines changed: 145 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -305,7 +305,151 @@ at least as dark as its predecessor. Only values between 1 - 999 are valid, and
305305

306306
<h3 id="font-size-prop">Font size: the 'font-size' property</h3>
307307

308-
Issue: Import from level 3
308+
<pre class="propdef">
309+
Name: font-size
310+
Value: <<absolute-size>> | <<relative-size>> | <<length-percentage>>
311+
Initial: medium
312+
Applies to: all elements
313+
Inherited: yes
314+
Percentages: refer to parent element's font size
315+
Computed value: absolute length
316+
Media: visual
317+
Animatable: As <<length>>
318+
</pre>
319+
320+
This property indicates the desired height of glyphs from the
321+
font. For scalable fonts, the font-size is a scale factor applied to the EM unit
322+
of the font. (Note that certain glyphs may bleed outside their EM box.) For
323+
non-scalable fonts, the font-size is converted into absolute units and matched
324+
against the declared font-size of the font, using the same absolute coordinate
325+
space for both of the matched values.
326+
Values have the following meanings:
327+
328+
<dl dfn-for=font-size dfn-type=value>
329+
<dt><dfn><<absolute-size>></dfn></dt>
330+
<dd>
331+
An <<absolute-size>> keyword refers to an entry
332+
in a table of font sizes computed and kept by the user agent. Possible values
333+
are:
334+
335+
[ xx-small | x-small | small | medium | large | x-large | xx-large ]
336+
</dd>
337+
338+
<dt><dfn><<relative-size>></dfn></dt>
339+
<dd>
340+
A <<relative-size>> keyword is interpreted
341+
relative to the table of font sizes and the computed 'font-size' of the
342+
parent element. Possible values are:
343+
344+
[ larger | smaller ]
345+
346+
For example, if the parent element has a font size of
347+
'medium', a value of 'larger' will make the font size of the
348+
current element be 'large'. If the parent element's size is not
349+
close to a table entry, the user agent is free to interpolate
350+
between table entries or round off to the closest one. The user
351+
agent may have to extrapolate table values if the numerical value
352+
goes beyond the keywords.
353+
</dd>
354+
355+
<dt><dfn><<length-percentage>></dfn></dt>
356+
<dd>
357+
A length value specifies an absolute font size
358+
(independent of the user agent's font table).
359+
Negative lengths are invalid.
360+
361+
A percentage value specifies an absolute font size relative
362+
to the parent element's font size. Use of percentage values, or
363+
values in 'em's, leads to more robust and cascadable style sheets.
364+
Negative percentages are invalid.
365+
</dd>
366+
</dl>
367+
368+
The following table provides user agent guidelines for the
369+
absolute-size scaling factor and their mapping to HTML heading and
370+
absolute font-sizes. The 'medium' value is used as the reference
371+
middle value. The user agent may fine-tune these values for different
372+
fonts or different types of display devices.
373+
374+
<table class="data">
375+
<thead>
376+
<th>CSS absolute-size values</th>
377+
<th>xx-small</td>
378+
<th>x-small</td>
379+
<th>small</td>
380+
<th>medium</td>
381+
<th>large</td>
382+
<th>x-large</td>
383+
<th>xx-large</td>
384+
<th>&nbsp;</td>
385+
</thead>
386+
<tbody>
387+
<tr>
388+
<th>scaling factor</th>
389+
<td>3/5</td>
390+
<td>3/4</td>
391+
<td>8/9</td>
392+
<td>1</td>
393+
<td>6/5</td>
394+
<td>3/2</td>
395+
<td>2/1</td>
396+
<td>3/1</td>
397+
</tr>
398+
<tr>
399+
<th>HTML headings</th>
400+
<td>h6</td>
401+
<td>&nbsp;</td>
402+
<td>h5</td>
403+
<td>h4</td>
404+
<td>h3</td>
405+
<td>h2</td>
406+
<td>h1</td>
407+
<td>&nbsp;</td>
408+
</tr>
409+
<tr>
410+
<th>HTML font sizes</th>
411+
<td>1</td>
412+
<td>&nbsp;</td>
413+
<td>2</td>
414+
<td>3</td>
415+
<td>4</td>
416+
<td>5</td>
417+
<td>6</td>
418+
<td>7</td>
419+
</tr>
420+
</tbody>
421+
</table>
422+
423+
<p class="note"><strong>Note 1.</strong> To preserve readability, an UA applying
424+
these guidelines should nevertheless avoid creating font-size resulting
425+
in less than 9 device pixels per EM unit on a computer display.</p>
426+
427+
<p class="note"><strong>Note 2.</strong> In CSS1, the suggested
428+
scaling factor between adjacent indexes was 1.5 which user experience
429+
proved to be too large. In CSS2, the suggested scaling factor for computer
430+
screen between adjacent indexes was 1.2 which still created issues for the small
431+
sizes. The new scaling factor varies between each index to provide a better
432+
readability.</p>
433+
434+
The actual value of this property may differ from the computed
435+
value due a numerical value on 'font-size-adjust' and the
436+
unavailability of certain font sizes.
437+
438+
Child elements inherit the computed 'font-size' value (otherwise, the
439+
effect of 'font-size-adjust' would compound).
440+
441+
<div class="example">
442+
<pre>
443+
p { font-size: 12pt; }
444+
blockquote { font-size: larger }
445+
em { font-size: 150% }
446+
em { font-size: 1.5em }
447+
</pre>
448+
</div>
449+
450+
<h3 id="font-size-adjust-prop">Relative sizing: the 'font-size-adjust' property</h3>
451+
452+
TODO: Migrate this from level 3.
309453

310454
<h2 id="font-resources">Font Resources</h2>
311455

0 commit comments

Comments
 (0)