css and font-size

Discussion in 'HTML' started by steve, Dec 2, 2003.

  1. steve

    steve Guest

    Hi

    I think I miss one of the css lessons:)

    I have table in a table, they both have the same style
    {font-family:arial; font-size:75%;}
    why does it the table in site of the other table apply the css 2 times
    and the text size is not 75% but is something like 50%
    why is that?
    do I miss one lesson in css?

    here is a sample http://www.watchestelltime.co.za/testcss.htm

    or here you can se the code

    <html>
    <head>
    <style>
    ..razmer {font-family:arial; font-size:75%;}
    </style>
    </head>
    <body>
    <table width="50%" border="1" class="razmer">
    <tr>
    <td>this is text in table 1<br>
    <br>
    <table width="50%" border="1" class="razmer">
    <tr>
    <td>this is text in tale 2</td>
    </tr>
    </table>
    </td>
    </tr>
    </table>
    </body>
    </html>
    steve, Dec 2, 2003
    #1
    1. Advertising

  2. steve

    brucie Guest

    in post <news:bqgl7o$rsh$>
    steve said:

    > I have table in a table, they both have the same style
    > {font-family:arial; font-size:75%;}


    thats is 25% smaller than your visitors preferred size - unreadable

    > why does it the table in site of the other table apply the css 2 times
    > and the text size is not 75% but is something like 50%
    > why is that?


    font is initially 75% defined again at 75% is 75% of 75%


    --
    brucie
    02/December/2003 10:09:39 am kilo
    brucie, Dec 2, 2003
    #2
    1. Advertising

  3. steve

    Eric Bohlman Guest

    "steve" <> wrote in news:bqgl7o$rsh$1@ctb-
    nnrp2.saix.net:

    > I have table in a table, they both have the same style
    > {font-family:arial; font-size:75%;}
    > why does it the table in site of the other table apply the css 2 times
    > and the text size is not 75% but is something like 50%
    > why is that?
    > do I miss one lesson in css?


    Yep, the lesson where they should have taught you that relative values for
    font sizes are always relative to the *computed* size used by the enclosing
    element. "font-size: 75%" means "make the font size three-quarters of what
    it would have been if I hadn't specified a font size for this element." So
    in your outer table, the font size is 75% of what it would be outside the
    table (in your example, that means 75% of the browser's default size), and
    in your inner table, it's 75% of what it is in the outer table (i.e. what
    it would be if you hadn't specified a style for the inner table), which
    works out to 56.25% of the default size.

    One of the more confusing aspects of CSS is that for some properties (like
    font size), percentage values are relative to computed values, while for
    other properties they're relative to set values. Keep a copy of the spec
    handy!
    Eric Bohlman, Dec 2, 2003
    #3
  4. steve

    Sid Ismail Guest

    On Tue, 2 Dec 2003 02:09:30 +0200, "steve" <>
    wrote:

    : Hi
    :
    : I think I miss one of the css lessons:)
    :
    : I have table in a table, they both have the same style
    : {font-family:arial; font-size:75%;}
    : why does it the table in site of the other table apply the css 2 times
    : and the text size is not 75% but is something like 50%
    : why is that?

    75% of 75% = 56.25%
    75% of the font size (already 75%)...

    : do I miss one lesson in css?

    You may have missed two actually...

    Sid
    Sid Ismail, Dec 2, 2003
    #4
  5. steve

    steve Guest

    > > I have table in a table, they both have the same style
    > > {font-family:arial; font-size:75%;}
    > > why does it the table in site of the other table apply the css 2

    times
    > > and the text size is not 75% but is something like 50%
    > > why is that?
    > > do I miss one lesson in css?

    >
    > Yep, the lesson where they should have taught you that relative

    values for
    > font sizes are always relative to the *computed* size used by the

    enclosing
    > element. "font-size: 75%" means "make the font size three-quarters

    of what
    > it would have been if I hadn't specified a font size for this

    element." So
    > in your outer table, the font size is 75% of what it would be

    outside the
    > table (in your example, that means 75% of the browser's default

    size), and
    > in your inner table, it's 75% of what it is in the outer table (i.e.

    what
    > it would be if you hadn't specified a style for the inner table),

    which
    > works out to 56.25% of the default size.
    >
    > One of the more confusing aspects of CSS is that for some properties

    (like
    > font size), percentage values are relative to computed values, while

    for
    > other properties they're relative to set values. Keep a copy of the

    spec
    > handy!


    Were can I find a list or sample or some kind of tutorial of which
    properties are relative to what and which one are not
    steve, Dec 2, 2003
    #5
  6. Quoth the raven named Eric Bohlman:
    ....
    > Yep, the lesson where they should have taught you that relative values for
    > font sizes are always relative to the *computed* size used by the enclosing
    > element. "font-size: 75%" means "make the font size three-quarters of what
    > it would have been if I hadn't specified a font size for this element." So
    > in your outer table, the font size is 75% of what it would be outside the
    > table (in your example, that means 75% of the browser's default size),


    Isn't is true that (in a good browser, I suppose) a table will inherit
    from body, rather than "browser's default size?" IOW, if the author
    mistakenly assigns a /body/ font of 75%, the outer table is 75% of
    75%, and the inner table is 75% of 75% of 75% .. well, you get the idea.

    But by this time, I've left for another site I can read.

    --
    -bts
    -This space intentionally left blank.
    Beauregard T. Shagnasty, Dec 2, 2003
    #6
  7. steve

    Marc Nadeau Guest

    steve a écrit:

    >
    > Were can I find a list or sample or some kind of tutorial of which
    > properties are relative to what and which one are not


    http://www.w3.org/TR/2003/WD-CSS21-20030915/propidx.html

    This is not a tutorial but 'the' reference.

    Well written, informative and downloadable.

    --
    Quand on regarde le ciel dans l'eau, on voit les poissons dans les arbres.
    Sancho P.
    Marc Nadeau, Dec 2, 2003
    #7
  8. steve

    Eric Bohlman Guest

    "Beauregard T. Shagnasty" <> wrote in
    news:3fTyb.155301$:

    >> font size for this element." So in your outer table, the font size
    >> is 75% of what it would be outside the table (in your example, that
    >> means 75% of the browser's default size),

    >
    > Isn't is true that (in a good browser, I suppose) a table will inherit
    > from body, rather than "browser's default size?" IOW, if the author
    > mistakenly assigns a /body/ font of 75%, the outer table is 75% of
    > 75%, and the inner table is 75% of 75% of 75% .. well, you get the
    > idea.


    That's why I qualified my statement with "in your example" since I don't
    recall him setting a font size on the body. You're right, of course, that
    had he done so, his page would *not* be in a state of grace.
    Eric Bohlman, Dec 2, 2003
    #8
    1. Advertising

Want to reply to this thread or ask your own question?

It takes just 2 minutes to sign up (and it's free!). Just click the sign up button to choose a username and then you can ask your own questions on the forum.
Similar Threads
  1. Andreas Klemt
    Replies:
    6
    Views:
    11,060
    Peter Theill
    Nov 28, 2004
  2. dave richards
    Replies:
    2
    Views:
    609
    Paul Furman
    Feb 19, 2004
  3. Wongod
    Replies:
    2
    Views:
    707
  4. wial
    Replies:
    2
    Views:
    818
  5. mttc
    Replies:
    2
    Views:
    2,386
    Roedy Green
    Jul 3, 2009
Loading...

Share This Page