Emanuel Grimoqua
Emanuel Grimoqua

Reputation: 3

Bootstrap, making <td> a dropdown trigger

I have this structure using bootstrap dropdowns:

<div id="navigation" class="row-fluid">
  <table class="basic" width="85%" border="0" cellspacing="0" cellpadding="0">
    <tr>
      <td class="current" height="60%" align="center" valign="center">
        <a href="<? echo base_url(); ?>">Home</a>
      </td>
      <td class="" align="center" valign="center">
        <div style="position: relative">
          <a id="dropdown1" class="dropdown-toggle" data-toggle="dropdown">About Us</a>
          <ul class="dropdown-menu dropdown" role="menu" aria-labelledby="dropdown1">
             <li><a class="node" tabindex="-1" href="<? echo base_url(); ?>unique/">What makes us unique?</a></li>
             <li><a class="node" tabindex="-1" href="<? echo base_url(); ?>promise/">Our promise to you</a></li>
             <li><a class="node" tabindex="-1" href="<? echo base_url(); ?>mission/">Mission and Vision</a></li>
             <li><a class="node" tabindex="-1" href="<? echo base_url(); ?>customers/">What do our customers say?</a></li>
             <li><a class="node" tabindex="-1" href="<? echo base_url(); ?>history/">Our History</a>  </li>
          </ul>
        </div>
    </tr>
  </table>
</div>

and this is css:

#navigation .basic {
   height: 100%;
   margin: 0 auto;
}

As I haven't managed to get td work as dropdown trigger (beccause of positioning), I created div and link inside.

Because of align in table my link is shorter that td height, how could I make td open dropdown instead of or make a height 100%?

Setting link height to 100% doesn't work.

Upvotes: 0

Views: 1508

Answers (1)

isherwood
isherwood

Reputation: 61063

A little CSS should cure what ails you. No need to change the triggering element.

http://jsfiddle.net/isherwood/SAwmV/1/

div.dropdown-wrapper {
    position: relative;
    height: 100%;
}
a.dropdown-toggle {
    height: 100%;
    display: block;
}

<div class="dropdown-wrapper">
    <a id="dropdown1" class="dropdown-toggle" data-toggle="dropdown">About Us</a>

    <ul>
    ...

Upvotes: 1

Related Questions