Doug Laidlaw wrote:
HTML validators say that "background" is not a valid attribute for a <td>
tag
I want to set an image as the background for one cell only, and to have the
cell content on top of it. If I can't use <td background="img
src=.."></td>, what is the correct method?
Some modern templates do it all with CSS, but that is getting a bit too deep
for my inexperience.
A URL is probably unnecessary, but here it is:
http://www.douglaidlaw.net/boykett/index.html
At the moment, it is a mess: too many tables within tables. The image of
the ship is the one in question. I want to re-do it from the bottom up,
and code the cell correctly in the process.
You might prefer to avoid style-sheets, but that is the way to do
backgrounds.
In your header section (between <HEAD> and </HEAD>) establish a
style class named cell:
<style TYPE="text/css">
<!--
td.cell {background-image: url(abc.xyz);
background-position: center center }
-->
</style>
You might want some other properties besides these two. Note that
the commenting <!-- and --> are not really necessary, but I still
use it to highlight my style-sheets. It makes them easier to
find. abc.xyz is the file name within the same directory as the
Web page (unless you indicate otherwise via link statements or by
explicitly stating the full URL of the file. Note that the
extension (.xyz) must be for some graphical image file-type that a
Web browser can display (e.g., .gif, .jpg).
Then, on your table cell, use <td class=cell> in place of <td>
where you want a background image.
If you intend to float text in front of the image, make sure that
the text can be read. See <URL:http://www.oakparkfoundation.org/>
for the use of a faint watermark image. This image was carefully
designed to minimize interference with text; it's best seen at the
bottom of the page. However, the optimal situation would avoid any
background image.
--
David E. Ross
<URL:http://www.rossde.com/>
I use Mozilla as my Web browser because I want a browser that
complies with Web standards. See <URL:http://www.mozilla.org/>.