Need help: a simple question about layers

J

Joe

Hi,

I have a table and one of the table cell contains some text. Instead of
hyper linking that text I want to position a layer covering the entire table
cell. The purpose here is to let the user click anywhere on the on the table
cell instead of just the text. The alternative is to turn text into image,
but I want to keep text as text.

Here is the code that I am using. Let me know if I am correct or doing
something wrong. I think I am doing something wrong because the layer is
getting inserting space in the html layout which I do NOT want.

Thanks for your help in advance.

joe


<!DOCTYPE html PUBLIC "-//W3C//DTD XHTML 1.0 Transitional//EN"
"http://www.w3.org/TR/xhtml1/DTD/xhtml1-transitional.dtd">
<html xmlns="http://www.w3.org/1999/xhtml">
<head>
<meta http-equiv="Content-Type" content="text/html; charset=iso-8859-1" />
<title>Untitled Document</title>
</head>
<body>
<table width="50%" border="1" cellspacing="0" cellpadding="0">
<tr>
<td width="47%"><img src="images/spacer.gif" width="200" height="50"
/></td>
<td width="53%"><img src="images/spacer.gif" width="200" height="50"
/></td>
</tr>
<tr>
<td><div style="position: relative; width: 219px; height: 57px; z-index:
1; left: 0px; top: 107px" id="layer1">
<a href="#"><img src="images/transparent.gif" width="200" height="50"
border="0" /></a></div>
This text should be a clickable…<br>
ABCDEFG…<br>…XYZ</td>
<td><img src="images/spacer.gif" width="200" height="50" /></td>
</tr>
</table>
</body>
</html>
 
C

Chris Leeds, MVP-FrontPage

I don't think you need to go to this extreme with the layer.
if you put a <div> around the text to be linked, it should "fill" the cell
(because it's a "block level" tag, making the whole cell a link, or the
contents of the cell at least.
like:
<td><a href="something.htm"><div>some text to get linked.</div></a></td>
you may have to give the div a height and width.

HTH



--
Chris Leeds,
Microsoft MVP-FrontPage

Make More Money with Less Work
Let Your Clients Control Their Content With Just A Browser!
http://contentseed.com/
 
M

Murray

Even simpler, do this -

<td><a href="something.htm" style="display:block;
background-color:gray;">some text to get linked</a></td>
 
J

Joe

Thanks guys, this code just worked fine.

<div style="width: 200px; height: 50px; z-index: 1; cursor: pointer"
onclick="location=somepage.html'">
some text goes here...
</div>
 
M

Murray

Mine is better....

--
Murray

Joe said:
Thanks guys, this code just worked fine.

<div style="width: 200px; height: 50px; z-index: 1; cursor: pointer"
onclick="location=somepage.html'">
some text goes here...
</div>
 

Ask a Question

Want to reply to this thread or ask your own question?

You'll need to choose a username for the site, which only take a couple of moments. After that, you can post your question and our members will help you out.

Ask a Question

Top