Non-Tiling Background within Table Cells??

liunx

Guest
I pretty much know how to make page backgrounds become non-tiling/repeating...but is it possible to have them non-tiled within a table or within a cell??<br />
<br />
What would be the code to insert?<br />
<br />
Thanks in advance!<!--content-->http://www.w3.org/TR/CSS2/colors.html#propdef-background is the W3C reference to the background property, which can be used with TABLE (<!-- m --><a class="postlink" href="http://www.w3.org/TR/html401/struct/tables.html#edef-TABLE">http://www.w3.org/TR/html401/struct/tab ... edef-TABLE</a><!-- m -->)s.<br />
<br />
[Jona]<!--content--><!DOCTYPE HTML PUBLIC "-//W3C//DTD HTML 4.01//EN"<br />
"http://www.w3.org/TR/html4/strict.dtd"><br />
<meta http-equiv="Content-Type" content="text/html; charset=iso-8859-1"><br />
<title>Example</title><br />
<style type="text/css"><br />
<!-- <br />
table {background:url(<!-- m --><a class="postlink" href="http://www.bettiepage.com/images/photos/bikini/bikini16_a.jpg">http://www.bettiepage.com/images/photos ... ni16_a.jpg</a><!-- m -->) no-repeat} <br />
--><br />
</style><br />
<table summary=""><br />
<tr><br />
<th>Heading</th><br />
<th>Heading</th><br />
<th>Heading</th><br />
</tr><br />
<tr><br />
<td>Data</td><br />
<td>Data</td><br />
<td>Data</td><br />
</tr><br />
<tr><br />
<td>Data</td><br />
<td>Data</td><br />
<td>Data</td><br />
</tr><br />
</table><!--content-->Thanks for the link!<br />
<br />
I still have to get back to my page and test those...but Charles code seems the most promising so far...however, does it place the image on the entire table?? I think i may need to place several non-tiled images within "cells" of tables...not only in one big table...<br />
<br />
Anyhoo thanks again!<!--content-->Originally posted by Four_of_Five <br />
I think i may need to place several non-tiled images within "cells" of tables...not only in one big table...<br />
<br />
In that case, you would use:<br />
<br />
<br />
<style type="text/css"><br />
td {background: url("image.jpg") no-repeat;}<br />
</style><br />
<br />
<br />
[Jona]<!--content-->Originally posted by Jona <br />
In that case, you would use:<br />
<br />
<br />
<style type="text/css"><br />
td {background: url("image.jpg") no-repeat;}<br />
</style><br />
<br />
<br />
[Jona] <br />
<br />
Thanks Jona!<br />
<br />
Hehehe ;)...i was just about figured it out that way too...you've just validated it...<br />
<br />
ok, now does it follow that I'd have to "number" the cells?? if I want each cell to have a different background??? what if hmmm...if each of the cells were on different tables???<br />
<br />
td1? td=2 hey, how do i know which td goes with a particular bg??<br />
Ahhhrrrg.....more questions! :(<br />
<br />
Sorry, i'm sooooo much a beginner at this CSS thing...it's im more of a JATF kinda gal...:rolleyes:<!--content-->You need to specify an ID for each cell. e.g.<br />
<br />
<TD ID="td1">cell one</TD><br />
<TD ID="td2">cell two</TD><br />
<TD ID="td3">cell three</TD><br />
<br />
and in the css it's <br />
<style type="text/css"> <!--<br />
#td1 {background: url("image1.jpg") no-repeat;} <br />
#td2 {background: url("image2.jpg") no-repeat;} <br />
#td3 {background: url("image3.jpg") no-repeat;} <br />
--><br />
</style><!--content-->Originally posted by Four_of_Five <br />
ok, now does it follow that I'd have to "number" the cells?? if I want each cell to have a different background??? what if hmmm...if each of the cells were on different tables???<br />
<br />
For individual cells, you'd use the style attribute on each TD:<br />
<br />
<br />
<TD STYLE="background: url(image.jpg) no-repeat;"><br />
<br />
<br />
The code I posted above will set the background for TDs in all tables within that HTML document.<br />
<br />
[Jona]<!--content-->Originally posted by DaveSW <br />
You need to specify an ID for each cell. <br />
<br />
Just to point out that you can also use CLASSES isntead of IDs, although it's best to use IDs, I thought I should point it out so that Four_of_Five knows about it as well:<br />
<br />
<br />
<style type="text/css"><br />
<!--<br />
td.td1 {background: url("image1.jpg") no-repeat;}<br />
td.td2 {background: url("image2.jpg") no-repeat;}<br />
td.td3 {background: url("image3.jpg") no-repeat;}<br />
--><br />
</style><br />
<!--The TDs--><br />
<td class="td1">First TD</td><br />
<td class="td2">Second TD</td><br />
<td class="td3">Third TD</td><br />
<br />
<br />
[Jona]<!--content-->
 
Back
Top