Forum Moderators: open

Message Too Old, No Replies

Define Border Color?

Can't Validate

         

andmunn

3:03 am on Mar 17, 2005 (gmt 0)

10+ Year Member



I have some code which reads simliar to this:
<table width="100%" cellpadding="0" cellspacing="0" border="1" bordercolor="#80A0BB" bgcolor="#80A0BB">

Now - when i validate with Transitional 4.01 - it tells me that "there is no attribute "BORDERCOLOR".

Whats the solution / workaround to this? I can't seem to figure it out using either HTML or CSS?
Any advice?

MatthewHSE

3:10 am on Mar 17, 2005 (gmt 0)

WebmasterWorld Senior Member 10+ Year Member



The "bordercolor" isn't a valid attribute. If you use CSS instead, your code should validate. Here's how it's done:

<style type="text/css">
.border {border: 1px solid #000000;}
</style>

You can also use things like:

border-top: 2px dotted #0000ff;
border-right: 10px solid #0000dd;

etc., etc.

andmunn

3:16 am on Mar 17, 2005 (gmt 0)

10+ Year Member



Hey!

Thanks for your quick reply ...

I tried using something like:

style="border: #FFFFFF"

But that doesn't seem to do the trick? I can't seem to find what the code is to have it effect hte "whole border" and not just a specific side? Any idea?

iamlost

3:38 am on Mar 17, 2005 (gmt 0)

WebmasterWorld Senior Member 10+ Year Member Top Contributors Of The Month



You need to specify a width or there is no border to colour. In CSS a unit of measurement i.e. px is required except with 0 (which is the same size in all measurements).

adding inline styling to your posted code:


<table cellpadding="0" cellspacing="0" style="border: 1px #80A0BB solid; background-color:#80A0BB; width: 100%;">

Note: You have your background and border the same colour.

On some (older) browsers the HTML deprecated code: cellpadding="0" cellspacing="0" can make a difference.

I recommend that you investigate CSS and utilise its power to a greater degree by removing the inline style to a CSS style section in the <head> or better an imported file utilising the power of id and class as illustrated by MatthewHSE.

andmunn

12:58 pm on Mar 17, 2005 (gmt 0)

10+ Year Member



Hi Guys,

Thanks for your help - i actually do use an external style sheet for most of my styling (except - i still use tables..).

However, i couldn't figure out the code for the "border" variable - it elluded me... I found out the problem though, that i need a "width" for the border in the style comment, and thats why mine wasn't showing correctly.

Thanks again for your help.
Andrew.

Robin_reala

1:11 pm on Mar 18, 2005 (gmt 0)

WebmasterWorld Senior Member 10+ Year Member



border is shorthand. If you want to just specify a color you'd need to use border-color. By adding a width and border type you've got a valid shorthand for border.

andmunn

4:21 pm on Mar 18, 2005 (gmt 0)

10+ Year Member



Thanks for the help - i have everything figured out :)
I added the variables to a sylsheet now, and used the "class" attribute to fetch them...it cut down my page size by about 5k too :) I love this CSS thingy.

Andrew.

choster

4:36 am on Mar 19, 2005 (gmt 0)

WebmasterWorld Senior Member 10+ Year Member



Incidentally, you can also eliminate cellspacing=0 by using border-collapse:collapse.

bartainer

7:06 pm on Mar 22, 2005 (gmt 0)

10+ Year Member



I have some code which reads simliar to this:
<table width="100%" cellpadding="0" cellspacing="0" border="1" bordercolor="#80A0BB" bgcolor="#80A0BB">

Now - when i validate with Transitional 4.01 - it tells me that "there is no attribute "BORDERCOLOR"

My advice, eliminate the border color [bordercolor="#80A0BB"] in the above code and use your style sheet to control the border. It won't hurt to eliminate the code.