Well, I'm almost valid but

M

Matt James

Larry,
Hi, I speak from recent and bitter experience re this.
You'll need to use css to define the table background, instead of stating it
in the way you have.

I did find a number of useful websites giving examples of this... I'll try
to track them down again and re-post.

In the meantime, try a google search for "css table background" or similar.

Cheers,
Matt
 
S

Starshine Moonbeam

Larry Webb said:
I can't figure out how to change the problem below so my site will validate.

URL - http://www.lockboxdoorprotector.com/

Problem - there is no attribute "BACKGROUND"
Code - <td background="images/layout_r7_c1.jpg">

<style>
td.whatever {background-image: url(images/layout_r7_c1.jpg)}
</style>

<td class="whatever"></td>
 
N

Neal

Larry Webb said:
I can't figure out how to change the problem below so my site will
validate.

A meta-comment, if I may, to you and/or whoever discovers this in a
search of the archives:

Your subject says that "you" are almost valid. Suggestion - don't
attach yourself to your code to much. I realize it's just a figure of
speech, but so many times I see people post here and it goes a little
like this:

A: My page won't work.
B: This is wrong and this should be changed to that.
A: Waa! You're mean!

And the whole of the problem is people take criticisms of their code
as if they were criticisms of themselves. We see it every day.

You are a totally valid and good person; you are loved, loving and
worthwhile. It's your code that sucks, that's all. Avoid mixing the
two up, so that when your code is criticized, you don't take it
personally.
 
R

rf

<td style="background:url('mages/layout.jpg')">

I would think

<td style="background:url('mages/layout_r7_c1.jpg')">

and probably

<td style="background-image: url('mages/layout_r7_c1.jpg')">
 
S

SpaceGirl

rf said:
I would think

<td style="background:url('mages/layout_r7_c1.jpg')">

and probably

<td style="background-image: url('mages/layout_r7_c1.jpg')">

No... that's not the recommended CSS shorthand. That wont validate on
some validators, or at least it'll warn you.

<td style="background: url('mages/layout_r7_c1.jpg')">

....is the recommended technique. You can then easily combine formatting
without bloating the CSS;

<td style="background-image: url('mages/layout_r7_c1.jpg');
backgrond-color:#ffffff;">

....becomes...

<td style="background:#fffff url('mages/layout_r7_c1.jpg');">

Much smaller, and you can use this for other formatting too, such as
borders etc.


--


x theSpaceGirl (miranda)

# lead designer @ http://www.dhnewmedia.com #
# remove NO SPAM to email, or use form on website #
 
J

Jukka K. Korpela

SpaceGirl said:
No... that's not the recommended CSS shorthand.

Which "that" is not recommended, and by which recommendation?
That wont validate
on some validators, or at least it'll warn you.

Calling CSS checkers "validators" is already confusing; no need to add
to the confusion by referring to them without specifying which checker
does what.
<td style="background: url('mages/layout_r7_c1.jpg')">

...is the recommended technique.

But that _is_ a shorthand, whereas the one with background-image, which
you seem to frown upon, is _not_ a shorthand.

The reason why background is better than background-image alone is that
you should always set background color, background image, and content
(text) color together*), and background always sets the background
color too. But background-color can be set separately too. _And_ the
color property needs to be set separately, so merely using the
background property doesn't solve the problem.

*) I'm too tired to explain the reason to this in detail, but any good
CSS book or tutorial does that. You haven't understood the basics of
CSS before you understand _why_ those properties should be set together
if at all.
You can then easily combine
formatting without bloating the CSS;

<td style="background-image: url('mages/layout_r7_c1.jpg');
backgrond-color:#ffffff;">

...becomes...

<td style="background:#fffff url('mages/layout_r7_c1.jpg');">

Yes, but the latter is not equivalent to the former - it sets more
properties.
 

Ask a Question

Want to reply to this thread or ask your own question?

You'll need to choose a username for the site, which only take a couple of moments. After that, you can post your question and our members will help you out.

Ask a Question

Members online

No members online now.

Forum statistics

Threads
473,755
Messages
2,569,536
Members
45,012
Latest member
RoxanneDzm

Latest Threads

Top