Question

I'm very new to coding and am taking a class to learn HTML5 and CSS3.

I have an old file however, that I need to update quickly for a client. It's set up with tables and inline styles which I know is a bit sloppy so I'm just trying to clean it up a little bit and get it to validate. I was able to get the file down from about 50 errors to just one but am stuck on figuring out this last part. Can someone point me in the right direction?

Thanks!

Line 68, Column 32: there is no attribute "background"

The DOCTYPE is XHTML 1.0 Transitional.

<tr>
<td colspan="3" background="http://www.website.com/image.jpg" align="left" style="font-family:museo300, Arial, Helvetica, sans-serif; font-size:32px; color:#145099; padding:0px 50px 0px 50px; line-height:38px;">Headline.
</td>
</tr>

I tried changing it to inline CSS using this code but now I have no background image. Can you tell me what I'm doing wrong? It looked fine before.

<tr>
<td colspan="3" align="left" style="font-family:museo300, Arial, Helvetica, sans-serif; font-size:32px; color:#145099; padding:0px 50px 0px 50px; line-height:38px; background-image:http://www.website.com/image.jpg;">Headline.
</td>
</tr>

I figured it out. I was coding the CSS wrong, should have been:

<tr>
<td colspan="3" align="left" style="font-family:museo300, Arial, Helvetica, sans-serif; font-size:32px; color:#145099; padding:0px 50px 0px 50px; line-height:38px; background-image: url(http://www.website.com/image.jpg);">Headline.
</td>
</tr>

Thanks for the help!

Was it helpful?

Solution

Since 1996, you should use the CSS background-image property.

Licensed under: CC-BY-SA with attribution
Not affiliated with StackOverflow
scroll top