473,327 Members | 2,081 Online
Bytes | Software Development & Data Engineering Community
Post Job

Home Posts Topics Members FAQ

Join Bytes to post your question to a community of 473,327 software developers and data experts.

Min-width problem on <LI> not content containers

dlite922
1,584 Expert 1GB
Before you baulk at yet another min-width problem, hear me out. I've been googling for a good hour now and experimenting but at no avail.

I have a horizontal UL/LI menu and I want the li width to be at least a certain amount (say 100px) but also extend if the text is longer than that.

Observe:
Expand|Select|Wrap|Line Numbers
  1. [ Item 1    ] [ Item 2    ] [ Long Item here ] [ Item 2   ]
  2.  
that being said, I don't know how to implement the various solutions (CSS only, I do not want a JS solution) such as this one:

Stu Nicholls | CSSplay | Min-Width for Internet Explorer

The relavant CSS code:

Expand|Select|Wrap|Line Numbers
  1. #cymenu li {   
  2.     float: left;
  3.     min-width: 100px;
  4.     text-align: left;
  5.     margin: 0;
  6.     padding: 0;
  7.     list-style: none;
  8.     font: bold 11px arial;
  9.     border-left: 1px solid #333333;
  10. }
the HTML code:

Expand|Select|Wrap|Line Numbers
  1.  <ul id="cymenu">
  2.                             <li>
  3.                                 <a href="#" >Item1</a>
  4.                             </li> 
  5. .
  6. .
  7. .
  8.  
using the solution in the link, the #cymenu li {} is the container and #cymenu li a {} is the inner div?

Well I tried that and all I got was a complete washed with what ever the color of the border was. (in the example, red). Even if this solution worked, I'd have to find a way to have a transparent border it seems because my menu has a gradient x-repeat background.

Also most of the solutions seem to refer to a browser window shrink, which I don't care about. My app won't be useful anyway if shrinked close to the menu.

Thanks for any pointers,





Dan
Dec 27 '08 #1
2 5580
drhowarddrfine
7,435 Expert 4TB
If I'm following you right, all you have to do is set a width for the <li>. min-width only sets the minimum but no maximum.
Dec 27 '08 #2
Dormilich
8,658 Expert Mod 8TB
I didn't understand the source either (well, maybe if I spent more time). I'd go for a zero height <div>.
Expand|Select|Wrap|Line Numbers
  1. // HTML
  2. <li>
  3.   // if you like you can use conditional comments
  4.   // around the div
  5.   <div class="min_width"></div>
  6. /* alternate solution for XHTML
  7.   <div class="min_width"/>
  8. */
  9.   <a href="...">...</a>
  10. </li>
  11.  
  12. // CSS
  13. .min_width {
  14.   width: 100px;
  15.   height: 0;
  16. }
if you know that javascript is running, you can add the div via javascript.

regards
Dec 27 '08 #3

Sign in to post your reply or Sign up for a free account.

Similar topics

16
by: Stanimir Stamenkov | last post by:
Take a look at: http://www.geocities.com/stanio/test/ie_and_floats.html Basically I got such content blocks: <div class="someblock"> <img class="preview" ...> <p>...</p> <div...
7
by: Lachlan Hunt | last post by:
Hi, In the "Firefox 5 Minute Challenge" that I'm trying to write the stylesheet for, the height of language bar needs controlled by the height of the content, so that if the window is not wide...
0
by: aassime abdellatif | last post by:
Question: How to obtain success and prosperity in this world and hereafter? What kind of success or prosperity that Islam wants the Ummah Islam gain in this world? Answer: Praise be to...
0
by: ryjfgjl | last post by:
ExcelToDatabase: batch import excel into database automatically...
1
isladogs
by: isladogs | last post by:
The next Access Europe meeting will be on Wednesday 6 Mar 2024 starting at 18:00 UK time (6PM UTC) and finishing at about 19:15 (7.15PM). In this month's session, we are pleased to welcome back...
0
by: Vimpel783 | last post by:
Hello! Guys, I found this code on the Internet, but I need to modify it a little. It works well, the problem is this: Data is sent from only one cell, in this case B5, but it is necessary that data...
0
by: jfyes | last post by:
As a hardware engineer, after seeing that CEIWEI recently released a new tool for Modbus RTU Over TCP/UDP filtering and monitoring, I actively went to its official website to take a look. It turned...
0
by: ArrayDB | last post by:
The error message I've encountered is; ERROR:root:Error generating model response: exception: access violation writing 0x0000000000005140, which seems to be indicative of an access violation...
1
by: PapaRatzi | last post by:
Hello, I am teaching myself MS Access forms design and Visual Basic. I've created a table to capture a list of Top 30 singles and forms to capture new entries. The final step is a form (unbound)...
1
by: CloudSolutions | last post by:
Introduction: For many beginners and individual users, requiring a credit card and email registration may pose a barrier when starting to use cloud servers. However, some cloud server providers now...
1
by: Shællîpôpï 09 | last post by:
If u are using a keypad phone, how do u turn on JavaScript, to access features like WhatsApp, Facebook, Instagram....
0
by: Faith0G | last post by:
I am starting a new it consulting business and it's been a while since I setup a new website. Is wordpress still the best web based software for hosting a 5 page website? The webpages will be...

By using Bytes.com and it's services, you agree to our Privacy Policy and Terms of Use.

To disable or enable advertisements and analytics tracking please visit the manage ads & tracking page.