Discussion: Font sizes are wrong
Afficher un message
Vieux 09/03/2008, 19h54   #8
Jukka K. Korpela
Aucun Avatar
 
Messages: n/a
Hébergeur:
Par défaut Re: Font sizes are wrong

Scripsit Steve Swift:

> Beauregard T. Shagnasty wrote:
>> You only need to specify the font-family once - in body { } - unless
>> you want to change some individual part elsewhere. The first C in
>> CSS is "Cascading".

>
> Except where it does not mean "Cascading".


It always does, but very few people understand the cascade; most people
who think they know CSS haven't even seriously tried to understand the
cascade. And the specifications are to be blamed, too. The concept is
just too complex for any normal human brain. But we have to do our best
with it.

> I was lulled into applying
> "vertical-align" to the TR tag by this belief.


This is a confusing issue but it has nothing to do with the cascade.

> The contrast between HTML, where the TR tag is often the best place to
> specify "ALIGN=TOP", and CSS, where applying "vertical-align:top"
> seems totally ineffective could hardly be more stark.


Such unexpected things need not reflect the cascade problems but seem to
originate from an assumed mapping of HTML attributes into CSS.

And I don't quite see how you get such results. If I set vertical-align:
top for a TR element, then the cells within the row become top-aligned,
unless some style sheet explicitly overrides that. I regard this is a
bug, since by definition, vertical-align is not inherited. Moreover,
even if it were defined as inherited, it should not get inherited into
table cells, since TH and TD elements have, in practice,
vertical-align: middle
in browser default style sheets.

If I try the following on IE 7 or Firefox 2, "foo" gets top aligned:

<table border="1"><tr style="vertical-align:bottom"><td>
hello<br>world</td>
<td>foo</td> </tr> </table>

By the specs, as I read them, it should be middle aligned.

Anyway, the proper way to make cells in a row vertically aligned in some
particular way is to vertical-align for the _cells_, not some enclosing
element. For example, if you have
<tr class="foo">...</tr>
you should not set
tr.foo { vertical-align: top; }
but
tr.foo th, tr.foo td { vertical-align: top; }

--
Jukka K. Korpela ("Yucca")
http://www.cs.tut.fi/~jkorpela/

  Réponse avec citation
 
Page generated in 0,05221 seconds with 9 queries