Hello and welcome to our community! Is this your first visit?
Register
Enjoy an ad free experience by logging in. Not a member yet? Register.
Results 1 to 8 of 8
  1. #1
    New to the CF scene
    Join Date
    May 2009
    Posts
    4
    Thanks
    1
    Thanked 0 Times in 0 Posts

    Smile CSS class won't work..

    Hi,

    I'm just trying to learn CSS, and for some reason the CSS class I'm trying to use is not working. I'm trying to make the font in the table red...


    Can someone tell me what I'm doing wrong?
    Thanks


    Code:
    <!DOCTYPE HTML PUBLIC "-//W3C//DTD HTML 4.01 Transitional//EN"
    "http://www.w3.org/TR/html4/loose.dtd">
    
    <html>
    
    <head>
    <meta http-equiv="Content-Type" content="text/html; charset=windows-1252">
    
    <style type="text/css">
    table.one
    {
    color:red
    }
    </style>
    
    </head>
    
    <body align=center>
    
    <?php
    
    $dollarsign = '$';
    $weeklypay = 700;
    $weeksmonth = 4;
    $daysmonth = 22;
    
    $monthlypay = ($weeklypay*$weeksmonth);
    $dailypay = $monthlypay/$daysmonth;
    ?>
    
    <center>Calculation of Income</center>
    
    <table style="one" border=1 cellpadding=5 cellspacing=0 align=center bgcolor=grey>
    
    <tr>
    <td align=center>Weekly Pay</td>
    <td align=center>Weeks Per Month</td>
    <td align=center>Monthly Pay</td>
    <td align=center>Work Day Pay</td>
    </tr>
    
    <tr>
    <td align=center><?php echo $dollarsign.$weeklypay ?></td>
    <td align=center><?php echo $weeksmonth ?></td>
    <td align=center><?php echo $dollarsign.$monthlypay ?></td>
    <td align=center><?php echo $dollarsign.$dailypay ?></td>
    </tr>
    
    </table>
    
    </body>
    </html>

  • #2
    Regular Coder
    Join Date
    May 2008
    Location
    Oxford, UK
    Posts
    422
    Thanks
    14
    Thanked 27 Times in 27 Posts
    change 'style="one"' to 'class="one"'

  • Users who have thanked brazenskies for this post:

    drey2k (05-16-2009)

  • #3
    New to the CF scene
    Join Date
    May 2009
    Posts
    4
    Thanks
    1
    Thanked 0 Times in 0 Posts
    Thank you.


    LOL

    I feel dumb now

  • #4
    Supreme Master coder! abduraooft's Avatar
    Join Date
    Mar 2007
    Location
    N/A
    Posts
    14,863
    Thanks
    160
    Thanked 2,224 Times in 2,211 Posts
    Quote Originally Posted by drey2k View Post
    I feel dumb now
    Use w3's HTML and CSS validators to avoid similar case in future
    The Dream is not what you see in sleep; Dream is the thing which doesn't let you sleep. --(Dr. APJ. Abdul Kalam)

  • #5
    Supreme Master coder! _Aerospace_Eng_'s Avatar
    Join Date
    Dec 2004
    Location
    In a place far, far away...
    Posts
    19,291
    Thanks
    2
    Thanked 1,043 Times in 1,019 Posts
    Quote Originally Posted by abduraooft View Post
    Use w3's HTML and CSS validators to avoid similar case in future
    The validator won't catch the error from the OP's code as its not really an error. It doesn't know that the inline CSS isn't valid.
    ||||If you are getting paid to do a job, don't ask for help on it!||||

  • #6
    Supreme Master coder! abduraooft's Avatar
    Join Date
    Mar 2007
    Location
    N/A
    Posts
    14,863
    Thanks
    160
    Thanked 2,224 Times in 2,211 Posts
    The validator won't catch the error from the OP's code as its not really an error. It doesn't know that the inline CSS isn't valid.
    Thanks for the correction, but why the validator skips that content inside the style attribute, though it detects something like style="blah:blah"
    The Dream is not what you see in sleep; Dream is the thing which doesn't let you sleep. --(Dr. APJ. Abdul Kalam)

  • #7
    Supreme Master coder! _Aerospace_Eng_'s Avatar
    Join Date
    Dec 2004
    Location
    In a place far, far away...
    Posts
    19,291
    Thanks
    2
    Thanked 1,043 Times in 1,019 Posts
    Guess I should have been more specific. The HTML validator won't catch the error. The CSS validator will.
    ||||If you are getting paid to do a job, don't ask for help on it!||||

  • #8
    Supreme Master coder! abduraooft's Avatar
    Join Date
    Mar 2007
    Location
    N/A
    Posts
    14,863
    Thanks
    160
    Thanked 2,224 Times in 2,211 Posts
    It doesn't know that the inline CSS isn't valid.
    Yeah, I misread the css-validators error message.
    When I made my first post, I was thinking that the CSS validator would give a proper error message for that invalid css property(?) in
    Code:
    <table style="one" border=1 cellpadding=5 cellspacing=0 align=center bgcolor=grey>
    and it does,
    21 Parse Error one
    The Dream is not what you see in sleep; Dream is the thing which doesn't let you sleep. --(Dr. APJ. Abdul Kalam)


  •  

    Posting Permissions

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