I have a piece of CSS implementing a click suckerfish menu.
The markup:
<table>
<tr>
<td>
<div class="bodywrapper">
<a class="button" href="#">
<ul class="menu">
<li>test test test</li>
<li>test test test test test test test test test test test test test test test</li>
</ul>
</a>
</div>
</td>
</tr>
</table>
Styles:
td{
width: 80px;
}
.button{
position: relative;
display: inline-block;
background-color: red;
width: 10px;
height: 27px;
}
.button:focus .menu, .button:active .menu{
display: block;
}
.menu{
display: none;
position: absolute;
min-width: 99px;
max-width: 700px;
width: auto;
border: 1px black solid;
margin-top: 27px;
}
Update, the above is actually contained within a table cell of fixed with
And a fiddle: http://jsfiddle.net/dAAXp/3/
The problem: I want this style definition to be used across the whole application. Therefore, the length of the text in the <li>
will vary. However, the behaviour I want is that the menu has a minimum and maxmium width. I have set this using min-width
and max-width
for .menu
. But for some reason, even if the content in the <li>
is less than the max-width
, the width of the menu is constrainted to the min-width
.
Could someone tell me why this is happening?