Table cell as link

Discussion in 'HTML' started by Clemenza, Mar 19, 2005.

  1. Clemenza

    Clemenza Guest

    Hello,

    I have a table for my menu. This table contains menu items as text. Each
    td tag contains a separate menu text.
    How is it possible (without javascript and making text as image) to make
    the whole td cell as link and not only the text?
    I tried to put the td cell inside the a tag, but it is not a valid html
    sollution.

    Any idea?

    Thanks!
     
    Clemenza, Mar 19, 2005
    #1
    1. Advertising

  2. Clemenza

    Steve Pugh Guest

    Clemenza <> wrote:

    >I have a table for my menu.


    Why? Doesn't sound like a table to me.

    >This table contains menu items as text. Each td tag contains a separate menu text.
    >How is it possible (without javascript and making text as image) to make
    >the whole td cell as link and not only the text?


    table.menu a {display: block;}

    replacing 'menu' with whatever classname you've given to your table.

    Steve

    --
    "My theories appal you, my heresies outrage you,
    I never answer letters and you don't like my tie." - The Doctor

    Steve Pugh <> <http://steve.pugh.net/>
     
    Steve Pugh, Mar 19, 2005
    #2
    1. Advertising

  3. Clemenza

    Nico Schuyt Guest

    Clemenza wrote:
    > I have a table for my menu. This table contains menu items as text.
    > Each td tag contains a separate menu text.
    > How is it possible (without javascript and making text as image) to
    > make the whole td cell as link and not only the text?
    > I tried to put the td cell inside the a tag, but it is not a valid
    > html sollution.
    > Any idea?


    Something like:
    <!DOCTYPE HTML PUBLIC "-//W3C//DTD HTML 4.01//EN"
    "http://www.w3.org/TR/html4/strict.dtd">
    <title>Table cell hover</title>
    <style type="text/css" media="all">
    table, td{border-collapse:collapse;border:1px solid gray;}
    td{vertical-align: top;}
    a{display:block;width:100%;height:100%;}
    a:hover{background:yellow;}
    </style>
    <table>
    <tr><td><a href="">xx</a></td><td>Text text text text text text
    text</td></tr>
    <tr><td><a href="">yyyyyy</a></td><td>Text text text text text text
    text</td></tr>
    </table>

    --
    Nico
    http://www.nicoschuyt.nl
     
    Nico Schuyt, Mar 19, 2005
    #3
  4. Clemenza

    Nico Schuyt Guest

    Nico Schuyt wrote:
    > Clemenza wrote:
    >> I have a table for my menu. This table contains menu items as text.
    >> Each td tag contains a separate menu text.
    >> How is it possible (without javascript and making text as image) to
    >> make the whole td cell as link and not only the text?
    >> I tried to put the td cell inside the a tag, but it is not a valid
    >> html sollution.
    >> Any idea?

    >
    > Something like:
    > a{display:block;width:100%;height:100%;}
    > a:hover{background:yellow;}


    But, like Steve already mentioned, a table probably is not necessary for the
    menu :)

    --
    Nico
    http://www.nicoschuyt.nl
     
    Nico Schuyt, Mar 19, 2005
    #4
    1. Advertising

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

It takes just 2 minutes to sign up (and it's free!). Just click the sign up button to choose a username and then you can ask your own questions on the forum.
Similar Threads
  1. Kevin Spencer

    Re: Link Link Link DANGER WILL ROBINSON!!!

    Kevin Spencer, May 17, 2005, in forum: ASP .Net
    Replies:
    0
    Views:
    898
    Kevin Spencer
    May 17, 2005
  2. Phillip Roncoroni
    Replies:
    14
    Views:
    1,123
    Toby A Inkster
    Apr 5, 2004
  3. a
    Replies:
    6
    Views:
    13,726
  4. Symphony

    add hyber link to table or table cell web control

    Symphony, Mar 15, 2005, in forum: ASP .Net Web Controls
    Replies:
    1
    Views:
    422
    Ken Cox [Microsoft MVP]
    Mar 16, 2005
  5. Greg N.

    empty table cell to be used as link

    Greg N., Apr 4, 2005, in forum: Javascript
    Replies:
    5
    Views:
    170
Loading...

Share This Page