473,387 Members | 1,569 Online
Bytes | Software Development & Data Engineering Community
Post Job

Home Posts Topics Members FAQ

Join Bytes to post your question to a community of 473,387 software developers and data experts.

How can I link entire table cell?

Anyone knows if it is possible to make the complete area of a table cell a
link onmousover or by hover?
In other words, I'd like to link, not only the text within the cell, but
the entire cell as well as the text within, to bla.html:

<table>
<tr><td> <br><br><a href="bla.html">bla</a><br><br> </td></tr>
</table>

How could this be done in pure HTML/CSS or/and with help of Javascript?

And what's the most backward compatible way vs. the proper CSS way?

Many thanks for any tips!

michael

Naeser's Law:
You can make it foolproof, but you can't make it
damnfoolproof.

Jul 20 '05 #1
9 56266
michael skrev:
Anyone knows if it is possible to make the complete area of a table cell a
link onmousover or by hover?
In other words, I'd like to link, not only the text within the cell, but
the entire cell as well as the text within, to bla.html:


a.link {display: block; width: 100%}
--
Knud
Jul 20 '05 #2
> a.link {display: block; width: 100%}

Thanks for the tip! Could you however make it a functional example based on
the below:

<table>
<tr><td> <br><br><a href="bla.html">bla</a><br><br> </td></tr>
</table>

Thanks again!
michael

"Deliver yesterday, code today, think tomorrow."

Jul 20 '05 #3
On Thu, 9 Sep 2004 19:21:55 +0200, michael <no****@example.com> wrote:
a.link {display: block; width: 100%}

Who wrote this? Please attribute.

I'd style a alone rather than the pseudoclass. I reserve .link .visited
..hover and .active for things which I want to change when these states
exist.
Thanks for the tip! Could you however make it a functional example based
on
the below:

<table>
<tr><td> <br><br><a href="bla.html">bla</a><br><br> </td></tr>
</table>


Don't use <br> so much. Only when you need to break a line
in the middle
like this.

a {display: block; width: 100%; margin: 2em auto;}

<table>
<tr><td><a href="bla.html">bla</a></td></tr>
</table>
Jul 20 '05 #4
michael wrote:
Anyone knows if it is possible to make the complete area of a table cell a
link onmousover or by hover?


Most people who wish to do this are using the a single column or row table
as a menu. This is not tabular data, this is list data. Try:

<http://css.maxdesign.com.au/listamatic/>

If it really is tabular data, then the principle is the same and the CSS
should be easy to adapt.

--
David Dorward <http://blog.dorward.me.uk/> <http://dorward.me.uk/>
Home is where the ~/.bashrc is
Jul 20 '05 #5
> Don't use <br> so much. Only when you need to break a line

It was just to fake some spacing above and below the link for a simplified
example sake, but it isn't going to be used at all on the actual page.
like this.

a {display: block; width: 100%; margin: 2em auto;}
How do I get that working with the below code? Sorry, but I've been on
holiday for the last couple of years....

Thanks!
michael
<table>
<tr><td><a href="bla.html">bla</a></td></tr>
</table>


--
A man said to the Universe: "Sir, I exist!"

"However," replied the Universe, "the fact has not created in me a
sense of obligation."
-- Stephen Crane

Jul 20 '05 #6
> Most people who wish to do this are using the a single column or row table
as a menu. This is not tabular data, this is list data. Try:


Nice examples! However, I'm stuck in tables, and its not really a nav-bar
I'm doing, I'm spiffing up some pre-coded cms-generated pricing tables and
I'm not in a position to change the structure to list formats.
But thanks for the example site - I'll bookmark it for later.

--
"Speed is subsittute fo accurancy."

Jul 20 '05 #7
On Thu, 9 Sep 2004 20:53:31 +0200, michael <no****@example.com> wrote:
Don't use <br> so much. Only when you need to break a line


It was just to fake some spacing above and below the link for a
simplified
example sake, but it isn't going to be used at all on the actual page.


Ok, my example below sets a margin (which probably ought to be padding
instead) to replace that, you can omit that part.
like this.

a {display: block; width: 100%; margin: 2em auto;}


How do I get that working with the below code? Sorry, but I've been on
holiday for the last couple of years....


Easy. It's CSS. One choice is to put this in the head element of the
document:

<style type="text/css">
table a {display: block; width: 100%;}
</style>

There are other ways. Check out the CSS tutorial at w3schools.com or at
htmldog.com (ignore the XHTML claptrap there). It'll explain all of this.
Jul 20 '05 #8
> <style type="text/css">
table a {display: block; width: 100%;}
</style>


Thanks - that does it fine and is easier than js/css combination.

michael

--
The shortest distance between two points is under construction.
-- Noelie Alito

Jul 20 '05 #9
On Thu, 9 Sep 2004 21:13:14 +0200, michael wrote:

(David D.)
Most people who wish to do this are using the a single column or row table
as a menu. This is not tabular data, this is list data. Try:
Nice examples! However, I'm stuck in tables, and its not really a nav-bar
I'm doing, I'm spiffing up some pre-coded cms-generated pricing tables and
I'm not in a position to change the structure to list formats.


Don't, even if you have the chance.

David made a good suggestion when he warned
you not to use a table for something that should
be a list (or, more generally, using tables for
*layout*).

OTOH, tables were designed for tabular data,
and 'pricing tables' sounds ..exactly like
tabular data.

If the HTML fits, use it..
Many thanks for any tips!


BTW. It is always a good idea to describe
an actual situation. If you had, responders
would not need to try and guess what you might
be doing. For further tips..
<http://www.spartanicus.utvinternet.ie/help_us_help_you.htm>

HTH

--
Andrew Thompson
http://www.PhySci.org/ Open-source software suite
http://www.PhySci.org/codes/ Web & IT Help
http://www.1point1C.org/ Science & Technology
Jul 20 '05 #10

This thread has been closed and replies have been disabled. Please start a new discussion.

Similar topics

3
by: Sir Loin of Beef | last post by:
I would like to create a table with a bar of text that spans the whole page. Here is what I have so far: <table border=0 width="100%" > <tr> <td><img src="SANimages/magnify.gif"></td> <td...
3
by: Thomas Mlynarczyk | last post by:
Hello, How can I make an <a> element (containing text only, styled to be a box with a border) as big as the table cell in which it resides, *without* having specified any width/height (neither...
7
by: John A. | last post by:
Hello all! I've got a big bunch of pages using tables for layout. Eventually I'll get them set up with more modernized code, but in the meantime I'd like to slip in a little quick holiday...
8
by: Ben | last post by:
Hi all, Just wondering how to write (using document.write) to a table cell. I have table with 3 rows and 3 colums. I want to write from within the Javascript to say third column of a first row....
4
by: Gary Hasler | last post by:
I have a full page of thumbnails linked to home plan pages. I'm adding a mouseover/mouseout effect to the table cells, plus a onclick event to permanently set the cell background to indicate the...
6
by: Anon | last post by:
I have a table with a cell. The cell's ID is created using a unique name that is held in m_UniqueCellName and the cell is created like so... document.write( "<TD ID="' + m_UniqueCellName +...
5
by: Greg N. | last post by:
Hi folks, 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...
1
by: Thanks | last post by:
I have a routine that is called on Page_Init. It retrieves folder records from a database which I display as Link Buttons in a table cell. I set the table cell's bgcolor to a default color (say...
0
by: urbancowboy | last post by:
Hi, I'm a complete noob to XSLT. My goal is to apply conditional formatting to the table-cell only so when the date = today, the entire table-cell background will highlight green (#00FF00) and not...
0
by: Charles Arthur | last post by:
How do i turn on java script on a villaon, callus and itel keypad mobile phone
0
by: ryjfgjl | last post by:
If we have dozens or hundreds of excel to import into the database, if we use the excel import function provided by database editors such as navicat, it will be extremely tedious and time-consuming...
0
by: ryjfgjl | last post by:
In our work, we often receive Excel tables with data in the same format. If we want to analyze these data, it can be difficult to analyze them because the data is spread across multiple Excel files...
0
by: emmanuelkatto | last post by:
Hi All, I am Emmanuel katto from Uganda. I want to ask what challenges you've faced while migrating a website to cloud. Please let me know. Thanks! Emmanuel
0
BarryA
by: BarryA | last post by:
What are the essential steps and strategies outlined in the Data Structures and Algorithms (DSA) roadmap for aspiring data scientists? How can individuals effectively utilize this roadmap to progress...
1
by: nemocccc | last post by:
hello, everyone, I want to develop a software for my android phone for daily needs, any suggestions?
1
by: Sonnysonu | last post by:
This is the data of csv file 1 2 3 1 2 3 1 2 3 1 2 3 2 3 2 3 3 the lengths should be different i have to store the data by column-wise with in the specific length. suppose the i have to...
0
by: Hystou | last post by:
There are some requirements for setting up RAID: 1. The motherboard and BIOS support RAID configuration. 2. The motherboard has 2 or more available SATA protocol SSD/HDD slots (including MSATA, M.2...
0
jinu1996
by: jinu1996 | last post by:
In today's digital age, having a compelling online presence is paramount for businesses aiming to thrive in a competitive landscape. At the heart of this digital strategy lies an intricately woven...

By using Bytes.com and it's services, you agree to our Privacy Policy and Terms of Use.

To disable or enable advertisements and analytics tracking please visit the manage ads & tracking page.