Sign Up

Sign Up to our social questions and Answers Engine to ask questions, answer people’s questions, and connect with other people.

Have an account? Sign In

Have an account? Sign In Now

Sign In

Login to our social questions & Answers Engine to ask questions answer people’s questions & connect with other people.

Sign Up Here

Forgot Password?

Don't have account, Sign Up Here

Forgot Password

Lost your password? Please enter your email address. You will receive a link and will create a new password via email.

Have an account? Sign In Now

You must login to ask a question.

Forgot Password?

Need An Account, Sign Up Here

Please briefly explain why you feel this question should be reported.

Please briefly explain why you feel this answer should be reported.

Please briefly explain why you feel this user should be reported.

Sign InSign Up

The Archive Base

The Archive Base Logo The Archive Base Logo

The Archive Base Navigation

  • SEARCH
  • Home
  • About Us
  • Blog
  • Contact Us
Search
Ask A Question

Mobile menu

Close
Ask a Question
  • Home
  • Add group
  • Groups page
  • Feed
  • User Profile
  • Communities
  • Questions
    • New Questions
    • Trending Questions
    • Must read Questions
    • Hot Questions
  • Polls
  • Tags
  • Badges
  • Buy Points
  • Users
  • Help
  • Buy Theme
  • SEARCH
Home/ Questions/Q 7794365
In Process

The Archive Base Latest Questions

Editorial Team
  • 0
Editorial Team
Asked: June 1, 20262026-06-01T22:45:13+00:00 2026-06-01T22:45:13+00:00

I have a piece of CSS implementing a click suckerfish menu. The markup: <table>

  • 0

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?

  • 1 1 Answer
  • 0 Views
  • 0 Followers
  • 0
Share
  • Facebook
  • Report

Leave an answer
Cancel reply

You must login to add an answer.

Forgot Password?

Need An Account, Sign Up Here

1 Answer

  • Voted
  • Oldest
  • Recent
  • Random
  1. Editorial Team
    Editorial Team
    2026-06-01T22:45:14+00:00Added an answer on June 1, 2026 at 10:45 pm

    EDIT: See bottom for answer to change in question (the solution is exactly the same)

    The reason is that the A is the first positionable (relative) block that the UL can expand into. Because the anchor is constrained to 10px the contained UL can only fill according to that anchors box dimensions.

    What you need to do is remove the position:relative from the anchor, add another ‘invisible’ container and set its position relative then your UL can expand upto the size limit of that element. see this fiddle for a fixed version

    In ‘english’ this is what your css says:

    UL: Ooh okay so my width is 100% (as you have not set width) of first parent marked with relative… Right so the Anchor above me is marked relative so my 100% width is 10px… but wait my min-width is 99px so I shall honour that.

    UPDATE:

    See fiddle with wrapper moved outside the table

    The logic is exactly the same as in first – you could probably set position relative on the table as it’s container AS LONG AS its width is 100% or greater than your required min/max widths of the contained child.

    On a side note once you get to the point where you cannot have a parent width bigger than required you will have to start looking at absolute positioning and breaking the element out of the parent (but i’ll leave that for now)

    FOR THE SEMANTIC AMONG YOU:

    I have added div wrapper – you can easilty apply this behaviour to any parent (i.e. the table/tr/td as long as it is wider than you need the min-max width @phpdev but once again if you reach the point where you parent is just not wide enough then you may have to break semantics

    • 0
    • Reply
    • Share
      Share
      • Share on Facebook
      • Share on Twitter
      • Share on LinkedIn
      • Share on WhatsApp
      • Report

Sidebar

Related Questions

I have a piece of code that is wrapped in a css class, the
I have the following piece of HTML: <ul id=downmenu> <li class=copyright> <div>&copy; 2011. All
I have the this piece of code here... <div class=pics2> <div style=position: absolute; top:
I have the following piece of code: $(document).ready(initialize); function initialize() { $('#btnPoint').css('width', $('#btnPoint').width()); }
I have the following piece of HTML: <style type=text/css> #c{width:200px;height:500px} </style> <canvas id=c></canvas> <script
I have a couple of Divs in my page with CSS class=hello Further I
I have the following piece of HTML that creates a table with a scrollbar
I have a piece of code working in knockout.js like this: <div> ... some
I have some code in HTML and CSS where HTML looks like this: <div
I have this piece of javascript that is working. var footerColour = $.color.extract($(div#one.footer), 'background-color');

Explore

  • Home
  • Add group
  • Groups page
  • Communities
  • Questions
    • New Questions
    • Trending Questions
    • Must read Questions
    • Hot Questions
  • Polls
  • Tags
  • Badges
  • Users
  • Help
  • SEARCH

Footer

© 2021 The Archive Base. All Rights Reserved
With Love by The Archive Base

Insert/edit link

Enter the destination URL

Or link to existing content

    No search term specified. Showing recent items. Search or use up and down arrow keys to select an item.