views:

14

answers:

3

Hey guys,

I got the following structure:

<td>
   <a>1. menu</a>
   <a>2. menu</a>
   <a>3. menu</a>
   <a>4. menu</a>
</td>

Of course, I have classes assigned to the elements. I am trying to adjust the height of those a elements to the outer td, so that the hover effect will fill from top to the bottom.

See here:

alt text

Any idea how I can accomplish that?

A: 

What about:

td a {
    display: inline-block;
    height: 100%;
}

You also have to remove padding (top and bottom) from td.

Dave
i tried it and it didn't work.
Kel
just edited my answer, you have to remove padding from the `td`
Dave
nope, I tried it
Kel
is it even possible to do those modifications with an A element?
Kel
It is possible to do these modifications, if you change them to block element as Dave suggested, but just a warning inline-block is not widely supported by browsers (especially older ones).
Nicknameless
This should work in IE6+, FF3+, Opera, Chrome. Alternatively set `display: block; float: left;`
Dave
A: 

You can change padding for a tags and remove height of td elements.

jcubic
+1  A: 

It would help alot if we could see your current CSS & actual mark up, but my guess from what you are trying to accomplish is that you need to add padding to the top & bottom of the to achieve the look you want.

Can I ask why you are putting it in a table instead of a list? If you where doing a list your code would be something like this:

<div id="custom_menu">
            <ul class="links">
                <li class="first">
                    <a>Link</a>
                </li>
                <li>
                    <a>Link</a>
                </li>
                <li>
                    <a>Link</a>
                </li>
                <li>
                    <a>Link</a>
                </li>
                <li>
                    <a>Link</a>
                </li>
                <li>
                    <a>Link</a>
                </li>
                <li>
                    <a>Link</a>
                </li>
                <li class="last">
                    <a>Link</a>
                </li>
            </ul><!-- end class=links -->
        </div><!-- end id=custom_menu -->

And this would be your CSS:

#custom_menu {
width: 850px;
margin: 0px auto;
padding: 0;
}
.links {
    list-style-type: none;
    margin: 9px auto;
    padding: 4px 0 0 30px;
    height: 23px;
    }
    .links li {
        display: inline !important;
        }
        .links em {
                display: none;
                background-color: red;
            height: 55px;
            font-size: .7em;
            margin: 0 0 0 -50px;
            padding: 3px 10px 10px 3px;
            position: absolute;
            text-align: center;
            width: 107px;
            z-index: 30;
            }
            .links .last em {
                margin: 0 0 0 -75px;
                }
Nicknameless
Well, I basically stumbled over existing code that needs maintenance :) I would've never done it this way.
Kel
The story of my life! I would try adding padding and removing the height of the td, but I think someone else already suggested that.
Nicknameless
well, I will try my best :) thanks for your help. And to the others too.
Kel