www.webdeveloper.com
Results 1 to 12 of 12

Thread: why does it not format all the text?

  1. #1
    Join Date
    Mar 2005
    Location
    Lisboa, Portugal
    Posts
    86

    why does it not format all the text?

    Why doesn't this CSS style format all the text on the page?

    Code:
    <style type="text/css">
    body {
    font-family:Verdana, Arial, Helvetica, sans-serif;
    font-size:10px;
    color:#000000;
    }
    </style>
    If there is a table inside the body the font-size remains the same even if I change it in the code above to 1000px. The only way to format the text inside the table is to create a CSS code like the one above replace the tag body with the table tag.

  2. #2
    Join Date
    Jul 2003
    Location
    New York City
    Posts
    2,771
    You must have some other CSS, or perhaps some horrid presentational markup like <font>, overriding it.

  3. #3
    Join Date
    Nov 2003
    Location
    Jerryville, Tejas
    Posts
    11,715
    Tables are cranky things that often refuse to inherit styles. You can use "body, td" as your selector or the ever so much more radical "*".
    "Debugging is twice as hard as writing the code in the first place. Therefore, if you write the code as cleverly as possible, you are, by definition, not smart enough to debug it." Brian W. Kernighan

  4. #4
    Join Date
    Jul 2003
    Location
    New York City
    Posts
    2,771
    Quote Originally Posted by ray326
    Tables are cranky things that often refuse to inherit styles. You can use "body, td" as your selector or the ever so much more radical "*".
    '*' ? You rebel! Actually, I tested it in IE and Firefox and it worked. My guess is that something else is going on.

  5. #5
    Join Date
    Nov 2003
    Location
    Jerryville, Tejas
    Posts
    11,715
    I usually style tables separately anyway so I guess I haven't noticed this recently.
    "Debugging is twice as hard as writing the code in the first place. Therefore, if you write the code as cleverly as possible, you are, by definition, not smart enough to debug it." Brian W. Kernighan

  6. #6
    Join Date
    Mar 2005
    Location
    Lisboa, Portugal
    Posts
    86
    Quote Originally Posted by MstrBob
    You must have some other CSS, or perhaps some horrid presentational markup like <font>, overriding it.
    No I don't. It's just like I told you.

    Full Code
    Code:
    <html>
    <head>
    <meta http-equiv="Content-Type" content="text/html; charset=iso-8859-1">
    <title>Teste</title>
    <style type="text/css">
    body {
    font-family:Verdana, Arial, Helvetica, sans-serif;
    font-size:10px;
    }
    </style>
    </head>
    <body>
    Testing Verdana
    <table align="left" border="1">
    <tr>
    <td>
    Testing Verdana
    </td>
    </tr>
    </table>
    </body>
    </html>
    Check the attachment: testing.htm
    I tested it both in Firefox 1.0.2 and in IE 6 and the result is the same.

  7. #7
    Join Date
    Apr 2003
    Location
    Netherlands
    Posts
    21,654
    Just another reason why you should use a valid DTD
    At least 98% of internet users' DNA is identical to that of chimpanzees

  8. #8
    Join Date
    Mar 2005
    Location
    Lisboa, Portugal
    Posts
    86

  9. #9
    Join Date
    Apr 2003
    Location
    Netherlands
    Posts
    21,654
    valid Document Type Definitions
    The style will work correctly in IE6 but earlier version will still have problems: table inheritance bug
    At least 98% of internet users' DNA is identical to that of chimpanzees

  10. #10
    Join Date
    Mar 2005
    Location
    Lisboa, Portugal
    Posts
    86

  11. #11
    Join Date
    Apr 2003
    Location
    Netherlands
    Posts
    21,654
    Code:
    <!DOCTYPE HTML PUBLIC "-//W3C//DTD HTML 4.01//EN"
       "http://www.w3.org/TR/html4/strict.dtd">
    <head>
    <meta http-equiv="Content-Type" content="text/html; charset=iso-8859-1">
    <title>Teste</title>
    <style type="text/css">
    body, html {
    font-family:Verdana, Arial, Helvetica, sans-serif;
    font-size:10px;
    }
    </style>
    </head>
    <body>
    Testing Verdana
    <table align="left" border="1">
    <tr>
    <td>
    Testing Verdana
    </td>
    </tr>
    </table>
    </body>
    </html>
    At least 98% of internet users' DNA is identical to that of chimpanzees

  12. #12
    Join Date
    Mar 2005
    Location
    Lisboa, Portugal
    Posts
    86
    Or
    Code:
    <style type="text/css">
    body, table {
    font-family:Verdana, Arial, Helvetica, sans-serif;
    font-size:10px;
    }
    </style>
    thank you
    Last edited by gimbras; 03-31-2005 at 09:40 AM.

Thread Information

Users Browsing this Thread

There are currently 1 users browsing this thread. (0 members and 1 guests)

Posting Permissions

  • You may not post new threads
  • You may not post replies
  • You may not post attachments
  • You may not edit your posts
  •  
HTML5 Development Center



Recent Articles