Logo Questions Linux Laravel Mysql Ubuntu Git Menu
 

HTML TD Clickable

I have a menu you can see on the top right hand side - www.balibar.co

HTML:

    <div id="joinHeader" class="shadow">
            <table id="indexNavigation"><tr>
                <td><a id="navSearch">Search</a></td>
                <td><a id="navLanguages">Languages</a></td>
                <td id="activeNavLink"><a id="navLogin">Login</a></td>
            </tr></table>
    </div>

CSS:

 table#indexNavigation {
width: 100%;
height: 25px;
font-weight: normal;
font-size: 1.1em;
border-collapse: collapse;
 }

 table#indexNavigation td {
text-align: center;
color: white;
width: 33.33%;
border-right: 1px solid #FFF;
cursor: pointer;
 }

table#indexNavigation td#activeNavLink {
border-right: none;
 }

I want to make the entire TD Clickable. I've added cursor: pointer; to the TD but it doesn't light up except when over the words. I tried putting the <a> outside the <td> but this didn't work.

Is there a trick to make this clickable. Will then hook this up to jQuery for a click event - e.g.:

 $('td#activeNavLink').click(function() {
like image 309
Adam Avatar asked Feb 19 '26 21:02

Adam


1 Answers

Just make your links inside your td tags have a width of 100%. Then they will take up the full width of the cell.

table#indexNavigation td a {
    display: block;
    width: 100%;
    text-align: center;
}
like image 193
Charles Boyung Avatar answered Feb 21 '26 14:02

Charles Boyung