Tek-Tips is the largest IT community on the Internet today!

Members share and learn making Tek-Tips Forums the best source of peer-reviewed technical information on the Internet!

  • Congratulations SkipVought on being selected by the Tek-Tips community for having the most helpful posts in the forums last week. Way to Go!

Validator @ W3 not liking my background and border attributes

Status
Not open for further replies.

RodS2

IS-IT--Management
Sep 11, 2007
33
0
0
US
I've done some research and I can't figure out what I am doing wrong. I run my site through the validator at W3 and everything comes back great except this:


Attribute "BACKGROUND" is not a valid attribute. Did you mean "background"?

<td height="71" background="images/line-bg.gif">


My site is HTML 4.01 Transitional.

How do I fix this so my site validates correctly?

Thanks for your help.
 
You should do this with CSS instead:
Code:
<td height="71" style="background:url(images/line-bg.gif)">
Ideally you should put these rules in an external style sheet, rather than applying them inline one <td> at a time.

-- Chris Hunt
Webmaster & Tragedian
Extra Connections Ltd
 
That's perfect for the code change. How would the .CSS entry look?
 
html:
Code:
<td height="71" style="background-image:url(images/line-bg.gif)">
and in css:
Code:
td {
height: 71px;
background-image: url(images/line-bg.gif);
}
Hope this helps :)

linux is the way forward!

Gareth :)
 
Further to Gareth's post, unless you want all your table columns to have the same look, add a class

HTML:
<td class="myClass">

CSS:
.myClass {
height: 71px;
background-image: url(images/line-bg.gif);
}


--------

GOOGLE is a great resource to find answers to questions like "how do i..."


--------
 
Status
Not open for further replies.

Part and Inventory Search

Sponsor

Back
Top