...

View Full Version : CSS class won't work..



drey2k
05-16-2009, 11:34 AM
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




<!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>

brazenskies
05-16-2009, 11:42 AM
change 'style="one"' to 'class="one"'

drey2k
05-16-2009, 11:45 AM
Thank you.


LOL

I feel dumb now :(

abduraooft
05-16-2009, 12:55 PM
I feel dumb now :( Use w3's HTML (http://validator.w3.org/) and CSS validators (http://jigsaw.w3.org/css-validator/) to avoid similar case in future :)

_Aerospace_Eng_
05-16-2009, 03:16 PM
Use w3's HTML (http://validator.w3.org/) and CSS validators (http://jigsaw.w3.org/css-validator/) 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.

abduraooft
05-16-2009, 03:33 PM
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"

_Aerospace_Eng_
05-16-2009, 04:47 PM
Guess I should have been more specific. The HTML validator won't catch the error. The CSS validator will.

abduraooft
05-16-2009, 05:14 PM
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

<table style="one" border=1 cellpadding=5 cellspacing=0 align=center bgcolor=grey> and it does,

21 Parse Error one



EZ Archive Ads Plugin for vBulletin Copyright 2006 Computer Help Forum