简体   繁体   中英

W3 Validation error - table background image - says no attribute for background

I have lots of errors on our homepage , and I'm working through the list, however there seems to be an issue that is difficult to get around...

I am using this for the doctype:

!DOCTYPE html PUBLIC "-//W3C//DTD XHTML 1.0 Transitional//EN" "http://www.w3.org/TR/xhtml1/DTD/xhtml1-transitional.dtd"

Which I believe to be correct, but W3 says that the attribute background doesn't exist although we have used background="/images/blahblah.jpg" all over the site...

The background attribute (for the table element) was an unofficial extension to HTML that never made it into the specification. Use the CSS background-image property instead.

you should use css for styling, eg

style="background: url('...');"

or better yet, use ids/classes and put the styling in an external css files.

The technical post webpages of this site follow the CC BY-SA 4.0 protocol. If you need to reprint, please indicate the site URL or the original address.Any question please contact:yoyou2525@163.com.

 
粤ICP备18138465号  © 2020-2024 STACKOOM.COM