473,732 Members | 2,214 Online
Bytes | Software Development & Data Engineering Community
+ Post

Home Posts Topics Members FAQ

Min-width problem on <LI> not content containers

dlite922
1,584 Recognized Expert Top Contributor
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 5601
drhowarddrfine
7,435 Recognized Expert Expert
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 Recognized Expert Moderator Expert
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
2496
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 class="clear"></div>
7
2225
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 enough, and the menu items wrap around to the next line, the height of the <ul> increases, and thus the background stays behind the list items. The height has been set using min-height for for those that support it and 'height' for IE only. It...
0
1317
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 Allah.
0
8946
marktang
by: marktang | last post by:
ONU (Optical Network Unit) is one of the key components for providing high-speed Internet services. Its primary function is to act as an endpoint device located at the user's premises. However, people are often confused as to whether an ONU can Work As a Router. In this blog post, we’ll explore What is ONU, What Is Router, ONU & Router’s main usage, and What is the difference between ONU and Router. Let’s take a closer look ! Part I. Meaning of...
0
8774
by: Hystou | last post by:
Most computers default to English, but sometimes we require a different language, especially when relocating. Forgot to request a specific language before your computer shipped? No problem! You can effortlessly switch the default language on Windows 10 without reinstalling. I'll walk you through it. First, let's disable language synchronization. With a Microsoft account, language settings sync across devices. To prevent any complications,...
0
9447
Oralloy
by: Oralloy | last post by:
Hello folks, I am unable to find appropriate documentation on the type promotion of bit-fields when using the generalised comparison operator "<=>". The problem is that using the GNU compilers, it seems that the internal comparison operator "<=>" tries to promote arguments from unsigned to signed. This is as boiled down as I can make it. Here is my compilation command: g++-12 -std=c++20 -Wnarrowing bit_field.cpp Here is the code in...
0
9181
tracyyun
by: tracyyun | last post by:
Dear forum friends, With the development of smart home technology, a variety of wireless communication protocols have appeared on the market, such as Zigbee, Z-Wave, Wi-Fi, Bluetooth, etc. Each protocol has its own unique characteristics and advantages, but as a user who is planning to build a smart home system, I am a bit confused by the choice of these technologies. I'm particularly interested in Zigbee because I've heard it does some...
0
8186
agi2029
by: agi2029 | last post by:
Let's talk about the concept of autonomous AI software engineers and no-code agents. These AIs are designed to manage the entire lifecycle of a software development project—planning, coding, testing, and deployment—without human intervention. Imagine an AI that can take a project description, break it down, write the code, debug it, and then launch it, all on its own.... Now, this would greatly impact the work of software developers. The idea...
0
4550
by: TSSRALBI | last post by:
Hello I'm a network technician in training and I need your help. I am currently learning how to create and manage the different types of VPNs and I have a question about LAN-to-LAN VPNs. The last exercise I practiced was to create a LAN-to-LAN VPN between two Pfsense firewalls, by using IPSEC protocols. I succeeded, with both firewalls in the same network. But I'm wondering if it's possible to do the same thing, with 2 Pfsense firewalls...
0
4809
by: adsilva | last post by:
A Windows Forms form does not have the event Unload, like VB6. What one acts like?
1
3261
by: 6302768590 | last post by:
Hai team i want code for transfer the data from one system to another through IP address by using C# our system has to for every 5mins then we have to update the data what the data is updated we have to send another system
3
2180
bsmnconsultancy
by: bsmnconsultancy | last post by:
In today's digital era, a well-designed website is crucial for businesses looking to succeed. Whether you're a small business owner or a large corporation in Toronto, having a strong online presence can significantly impact your brand's success. BSMN Consultancy, a leader in Website Development in Toronto offers valuable insights into creating effective websites that not only look great but also perform exceptionally well. In this comprehensive...

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.