font-size in <table> is not herited from <body> ?

Collapse
This topic is closed.
X
X
 
  • Time
  • Show
Clear All
new posts
  • PYG

    font-size in <table> is not herited from <body> ?

    Hi everybody

    I have a simple question :

    If i use this code :
    <body style="font-size:24px;color :blue;">
    Text in body
    <table>
    <tr><td>
    Text in table
    </td></tr>
    </table>
    </body>

    I define a body style with à 24px font size and blue color

    The text in the body appears with these attributes : fine !
    When i use a table inside the body, the text in the table is blue (cascading
    style from body : OK), but the font size is not 24px (reset to default size
    i think).

    So my question is : Why does the attribute font-size is not propagated to
    the text in the table and how can i do that without adding a new font-size
    style in the table itself ?

    Many thank for any answer.



  • dorayme

    #2
    Re: font-size in &lt;table&gt ; is not herited from &lt;body&gt; ?

    In article <484902f9$0$236 50$426a34cc@new s.free.fr>,
    "PYG" <pyg@NOSPAM-advi.frwrote:
    Hi everybody
    >
    I have a simple question :
    >
    If i use this code :
    <body style="font-size:24px;color :blue;">
    Text in body
    <table>
    <tr><td>
    Text in table
    </td></tr>
    </table>
    </body>
    >
    I define a body style with à 24px font size and blue color
    >
    The text in the body appears with these attributes : fine !
    When i use a table inside the body, the text in the table is blue (cascading
    style from body : OK), but the font size is not 24px (reset to default size
    i think).
    >
    So my question is : Why does the attribute font-size is not propagated to
    the text in the table and how can i do that without adding a new font-size
    style in the table itself ?
    >
    Many thank for any answer.
    Try a proper doctype (this one does not allow loose text in body, but
    this has nothing to do with your problem):

    <!DOCTYPE HTML PUBLIC "-//W3C//DTD HTML 4.01//EN"
    "http://www.w3.org/TR/html4/strict.dtd">
    <html>
    <head>
    <title>gaps"</title>
    <style type="text/css" media="screen">
    </style>
    </head>
    </html>
    <body style="font-size:50px;color :blue;">
    <p>Text in body</p>
    <table>
    <tr><td>
    Text in table
    </td></tr>
    </table>
    </body>

    I cannot say for sure about WinIE.

    Btw, best not to use px for font-size. Google for why or look up the
    archives of this group.

    --
    dorayme

    Comment

    • Steve Pugh

      #3
      Re: font-size in &lt;table&gt ; is not herited from &lt;body&gt; ?

      On Jun 6, 10:29 am, "PYG" <p...@NOSPAM-advi.frwrote:
      >
      If i use this code :
      A URL is more useful than a code snippet. As I explain below the
      reason for your problem is to do with a different part of the page.
      <body style="font-size:24px;color :blue;">
      Text in body
      <table>
      <tr><td>
      Text in table
      </td></tr>
      </table>
       </body>
      >
      I define a body style with à 24px font size and blue color
      Which, by the by, is a bad idea. Pixels are not the most suitable unit
      for font sizes on the web and setting a colour without also setting a
      background colour can cause problems when the user has a default
      background of, for example, blue.
      The text in the body appears with these attributes : fine !
      When i use a table inside the body, the text in the table is blue (cascading
      style from body : OK), but the font size is not 24px (reset to default size
      i think).
      >
      So my question is : Why does the attribute font-size is not propagated to
      the text in the table and how can i do that without adding a new font-size
      style in the table itself ?
      The answer depends on the rest of the page.

      Back in the old days of <fonttags the font size was not inherited
      into tables. When CSS support was first added to browsers it was made
      backwards compatible with <fonttags and so the font size was not
      inherited into tables. This has been fixed in newer browsers, but they
      still maintain a backwards compatability option, usually known as
      "quirks mode". The browser decides to use quirks mode or standards
      mode depending on the doctype, or lack of, on the page. Google for
      "doctype switching".

      Steve


      Comment

      • PYG

        #4
        Re: font-size in &lt;table&gt ; is not herited from &lt;body&gt; ? [Solved]


        I used this doctype :
        <!DOCTYPE html PUBLIC "-//W3C//DTD XHTML 1.0 Transitional//EN"
        "http://www.w3.org/TR/xhtml1/DTD/xhtml1-transitional.dt d">

        I repaced it by this one :

        <!DOCTYPE HTML PUBLIC "-//W3C//DTD HTML 4.01//EN"
        "http://www.w3.org/TR/html4/strict.dtd">

        And it wordks fine !!

        Many thanks

        "dorayme" <doraymeRidThis @optusnet.com.a ua écrit dans le message de news:
        doraymeRidThis-0970EC.19422806 0620...usnet.co m.au...
        In article <484902f9$0$236 50$426a34cc@new s.free.fr>,
        "PYG" <pyg@NOSPAM-advi.frwrote:
        >
        >Hi everybody
        >>
        >I have a simple question :
        >>
        >If i use this code :
        ><body style="font-size:24px;color :blue;">
        >Text in body
        ><table>
        ><tr><td>
        >Text in table
        ></td></tr>
        ></table>
        > </body>
        >>
        >I define a body style with à 24px font size and blue color
        >>
        >The text in the body appears with these attributes : fine !
        >When i use a table inside the body, the text in the table is blue
        >(cascading
        >style from body : OK), but the font size is not 24px (reset to default
        >size
        >i think).
        >>
        >So my question is : Why does the attribute font-size is not propagated to
        >the text in the table and how can i do that without adding a new
        >font-size
        >style in the table itself ?
        >>
        >Many thank for any answer.
        >
        Try a proper doctype (this one does not allow loose text in body, but
        this has nothing to do with your problem):
        >
        <!DOCTYPE HTML PUBLIC "-//W3C//DTD HTML 4.01//EN"
        "http://www.w3.org/TR/html4/strict.dtd">
        <html>
        <head>
        <title>gaps"</title>
        <style type="text/css" media="screen">
        </style>
        </head>
        </html>
        <body style="font-size:50px;color :blue;">
        <p>Text in body</p>
        <table>
        <tr><td>
        Text in table
        </td></tr>
        </table>
        </body>
        >
        I cannot say for sure about WinIE.
        >
        Btw, best not to use px for font-size. Google for why or look up the
        archives of this group.
        >
        --
        dorayme

        Comment

        Working...