Jump to content

how to stop same color warning with inline css


redarrow

Recommended Posts

advance thank you.....

 

becouse i use the same color with inline css i get the dreaded warning from valdation

please can u tell me how to get rid off the warning..

 

can someone kindly show me how to use the same color with inline css.....

 

thank you........

 

<table align="center" style="border-style: solid; background: #FF0000; border-color: #FF0000; width: 692px;">
<tr>
<td style="width: 20%; background: #808080;" align="center">
<a style="text-decoration: none;" href="index.php">Home</a>
</td>
<td style="width: 20%; background: #808080;" align="center">
<a style="text-decoration: none;" href="services.php">Service</a>
</td>
<td style="width: 20%; background: #808080;" align="center">
<a style="text-decoration: none;" href="sale.php">For Sale</a>
</td>
<td style="width: 20%; background: #808080;" align="center">
<a style="text-decoration: none;" href="links.php">Links</a>
</td>
<td style="width: 20%; background: #808080;" align="center">
<a style="text-decoration: none;" href="contact.php">Contact Us</a>
</td>
</tr>
</table>

The same color as what? What is the error you are getting?

 

Your use of CSS here is very inefficient. It basically goes against the whole idea behind CSS - only have to declare something one time.

 

Put this in the head of your document:

 

<style type="text/css">
td
{
    width: 20%;
    background: #808080;
    text-align: center;
}

a
{
    text-decoration: none;
}
</style>

 

and change your td tags to look like this:

 

<td>

 

and your 'a' tags to look like this:

 

a

 

That will cut your code significantly, and if you want to change anything you will only have to change it in one spot, rather than every single tag on the page. It makes your code more compact and easier to read as well.

Archived

This topic is now archived and is closed to further replies.

×
×
  • Create New...

Important Information

We have placed cookies on your device to help make this website better. You can adjust your cookie settings, otherwise we'll assume you're okay to continue.