PDA

View Full Version : how to set image as a cell background


andymac63
11-10-2006, 10:20 AM
Hi,

Sorry if this Question seems trivial - I just can't work out how to do it.

How do I make an image the background for a table cell. I can import images into cells easily enough but I can't then enter text above them without the use of layers!


many thanks in advance

Andy

davidj
11-10-2006, 11:07 AM
<td background="Images/image.jpg">

you could use a CSS class to define your <td bg which would be better

andymac63
11-10-2006, 12:52 PM
Thanks for that - it is exactly what I couldn't do.

The only issue with it is that Dreamweaver tiles the picture I choose. So instead of getting a single sample I get a multitude


How do you keep the image to a single occurance?

HeadAche
11-10-2006, 01:29 PM
Yeah, use CSS to do this as the td background image property isnt XHTML 1.0 complient (its a Microsoft thing) and wont be seen in some (most) browsers.

Just make a new CSS property in dreamweaver, goto Background, set a background image and set it no tile X or Y etc...

CSS
<style type="text/css">
<!--
.tdBgImage {
background-attachment: scroll;
background-image: url(../image.jpg);
background-repeat: no-repeat;
}
-->
</style>


Table cell
<td class="tdBgImage">stuff inside the table cell here</td>

domedia
11-10-2006, 01:37 PM
Just make sure you don't call an image with specifying the C drive as the location ;)

andymac63
11-10-2006, 01:39 PM
thanks guys - I 've got the CSS version working absolutely fine

Thank You