Greg N. wrote:
I have a table cell with a background image, something like
<td background=landscape.jpg height=200></td>
The sole purpose of this code is to display the image inside that table
cell. It displays just as much of the image as the current cell width
allows. The actual cell width is determined by other cells in the same
table column and by the current browser window width.
That's exactly what I want. I am not using an <img> tag to display the
image because it would exceed the page width. I don't want a horizontal
scroll bar on the page.
Now the question: How can I turn that cell into a link?
I have placed an <a...></a> tag inside the cell, but whatever content I
put there would at least partly overlay the picture, which I don't want.
If you need a link in your markup then use one to have the proper
structure and semantics in your document:
<a href="http://example.com">link</a>
If you want it to fill a table cell then you could use CSS to make it a
block element e.g.
<style type="text/css">
td.link a:link {
display: block;
width: 100%;
height: 100%;
}
</style>
...
<td class="link">
<a href="http://example.com">link</a>
</td>
You could choose to have an empty link
<td class="link">
<a href="http://example.com"> </a>
</td>
and rely on the background image being rendered but you shouldn't really
do that, what about users with browsers that don't render images (either
as they are pure text browsers or as users have configured the browser
not to render images). You should first aim to have properly structured
semantic markup and then look at CSS to suggest the presentation of that
markup. You seem to currently aim at a particular presentation which
could result in a non-functional page with no link or a not visible link
for browser users.
--
Martin Honnen
http://JavaScript.FAQTs.com/