Tycoon Talk
Become a Big fish!
The number 1 forum for online business!
Post topics, ask questions, share your knowledge.
Tycoon Talk is part of Freelancer.com - find skilled workers online at a fraction of the cost.

CSS Forum


You are currently viewing our CSS Forum as a guest. Please register to participate.
Login



Reply
Centered Suckerfish Menu with Auto Item Width
Old 06-16-2008, 05:29 PM Centered Suckerfish Menu with Auto Item Width
undoIT's Avatar
Average Talker

Latest Blog Post:
Alienware coupon code
Posts: 27
Trades: 0
I'd like to add a drop-down menu on themebot.com. It needs to be light-weight and accessible for search engines. I've looked at Suckerfish, Suckerfish variations and other CSS-based drop down menus but I haven't found a technique that will work for this specific situation:

1. The first requirement is that the menu needs to be centered with something like
Code:
margin:0px auto;
. I can manually center the flat list by adding margin to the left side, but this will not work well because different browsers use different fonts and so the menu will be off-center in some browsers.

The second requirement is that the menu items need to all have the same amount of padding on the right and left sides. The dropdown menus I've seen that can be centered use a set width for the list items. This adds a lot of unnecessary padding. For example, the menu items "FAQ" and "Website Templates" will both have the same set width. This limits the number of top level menu items that can be added and doesn't look very good.

Does anyone know of a technique that works for both of the requirements above?

Thanks in advance!
__________________

Please login or register to view this content. Registration is FREE
|
Please login or register to view this content. Registration is FREE
|
Please login or register to view this content. Registration is FREE
undoIT is offline
Reply With Quote
View Public Profile Visit undoIT's homepage!
 
 
Register now for full access!
Old 06-16-2008, 07:16 PM Re: Centered Suckerfish Menu with Auto Item Width
vangogh's Avatar
Post Impressionist

Latest Blog Post:
Why Responsive Design?
Posts: 10,815
Name: Steven Bradley
Location: Boulder, Colorado
Trades: 0
For the first issue specify the font. You won't be able to control what everyone sees, but as long as you specify something common most people will see the same font.

What I've done with the extra padding issue is to set ids on specific dropdowns and then given them a different width than other sub menus. Your FAQ list will have one width while your 'website templates' list will use another width.

Add the id to the <ul> for the submenu and then you can style that one submenu different than the others.
__________________
l Search Engine Friendly Web Design |
Please login or register to view this content. Registration is FREE

l Tips On Marketing, SEO, Design, and Development |
Please login or register to view this content. Registration is FREE

l
Please login or register to view this content. Registration is FREE
|
Please login or register to view this content. Registration is FREE
vangogh is offline
Reply With Quote
View Public Profile Visit vangogh's homepage!
 
Old 06-16-2008, 09:23 PM Re: Centered Suckerfish Menu with Auto Item Width
undoIT's Avatar
Average Talker

Latest Blog Post:
Alienware coupon code
Posts: 27
Trades: 0
Even if I specify the font family, Windows is going to be different than OSX which is going to be different than Linux. The block level item containing the menu needs to be automatically centered using either margin: 0 auto; or text-align: center;
__________________

Please login or register to view this content. Registration is FREE
|
Please login or register to view this content. Registration is FREE
|
Please login or register to view this content. Registration is FREE
undoIT is offline
Reply With Quote
View Public Profile Visit undoIT's homepage!
 
Old 06-17-2008, 03:38 PM Re: Centered Suckerfish Menu with Auto Item Width
LadynRed's Avatar
Defies a Status

Posts: 10,017
Location: Tennessee
Trades: 0
Quote:
Even if I specify the font family, Windows is going to be different than OSX which is going to be different than Linux.
Which is exactly why you specify more than one font and always include the plain vanilla serif or sans-serif as the last resort default.

I always specify fonts this way :
font: 100.01% Verdana, Arial, Georgia, Helvetica, sans-serif;

That pretty much hits most of the OS's included fonts for a sans-serif face.
__________________
Web Goddess & Web Standards Evangelist :) - Tables Be Gone !!

Please login or register to view this content. Registration is FREE


Please login or register to view this content. Registration is FREE

LadynRed is offline
Reply With Quote
View Public Profile
 
Old 06-17-2008, 04:11 PM Re: Centered Suckerfish Menu with Auto Item Width
undoIT's Avatar
Average Talker

Latest Blog Post:
Alienware coupon code
Posts: 27
Trades: 0
Quote:
Originally Posted by LadynRed View Post
Which is exactly why you specify more than one font
Which is exactly why specifying a font won't work for this particular purpose. Different fonts have different character widths and letter spacings and will cause the navigation bar to be off center depending on the font that is installed on the user's operating system and the user's font preferences (when centering the menu using left margin). I'm beginning to think that a centered CSS dropdown menu with automatic menu item widths is impossible.
__________________

Please login or register to view this content. Registration is FREE
|
Please login or register to view this content. Registration is FREE
|
Please login or register to view this content. Registration is FREE

Last edited by undoIT; 06-17-2008 at 04:14 PM..
undoIT is offline
Reply With Quote
View Public Profile Visit undoIT's homepage!
 
Old 06-17-2008, 05:20 PM Re: Centered Suckerfish Menu with Auto Item Width
vangogh's Avatar
Post Impressionist

Latest Blog Post:
Why Responsive Design?
Posts: 10,815
Name: Steven Bradley
Location: Boulder, Colorado
Trades: 0
Is there a reason why the {margin: 0 auto} isn't working to center the menu?
__________________
l Search Engine Friendly Web Design |
Please login or register to view this content. Registration is FREE

l Tips On Marketing, SEO, Design, and Development |
Please login or register to view this content. Registration is FREE

l
Please login or register to view this content. Registration is FREE
|
Please login or register to view this content. Registration is FREE
vangogh is offline
Reply With Quote
View Public Profile Visit vangogh's homepage!
 
Old 06-17-2008, 05:33 PM Re: Centered Suckerfish Menu with Auto Item Width
undoIT's Avatar
Average Talker

Latest Blog Post:
Alienware coupon code
Posts: 27
Trades: 0
The only way i've been able to get the menu item containers to autofit for each link anchor text is by applying "float:left;display:block;padding:0 7px" for all the <li> tags in the top level menu items. Then, of course, the <ul> containing all the menu items will not center with auto margins.
__________________

Please login or register to view this content. Registration is FREE
|
Please login or register to view this content. Registration is FREE
|
Please login or register to view this content. Registration is FREE
undoIT is offline
Reply With Quote
View Public Profile Visit undoIT's homepage!
 
Old 06-17-2008, 06:36 PM Re: Centered Suckerfish Menu with Auto Item Width
LadynRed's Avatar
Defies a Status

Posts: 10,017
Location: Tennessee
Trades: 0
Quote:
Then, of course, the <ul> containing all the menu items will not center with auto margins.
It will if you define a width for the UL.

As with many things to do with cross-browser compatibility, sometimes you have to be able to bend, to be a little bit more flexible. Pixel-perfection is nearly impossible, with browsers doing slightly different things and users doing wildly different things on top of that.

I think a great deal of your problem is you've got everything stuck in tables.
__________________
Web Goddess & Web Standards Evangelist :) - Tables Be Gone !!

Please login or register to view this content. Registration is FREE


Please login or register to view this content. Registration is FREE

LadynRed is offline
Reply With Quote
View Public Profile
 
Old 06-17-2008, 06:49 PM Re: Centered Suckerfish Menu with Auto Item Width
undoIT's Avatar
Average Talker

Latest Blog Post:
Alienware coupon code
Posts: 27
Trades: 0
Quote:
Originally Posted by LadynRed View Post
As with many things to do with cross-browser compatibility, sometimes you have to be able to bend, to be a little bit more flexible.
Yep. I've touched my toes, i've touched my nose to my elbows, i've had both legs tucked behind my head and i still can't figure this one out :P

If I give the <ul> a set-width and fit it to the exact width of the menu, then there is going to be overflow for people with larger fonts. I'm thinking I will just reorganize the top level menus a bit so that the link text for each one is more equal in width, then set a fixed width for all the <li> menu items. This seems to be the simplest solution and will have the least amount of code bloat.

I've gotten rid of all the tables I have control over with the version of Joomla I am using with the site. Unfortunately, the core files would need to be hacked quite a bit to eliminate the rest of them. If and when I upgrade to Joomla 1.5, I'll be able to fix this.

Thanks for the ideas
undoIT is offline
Reply With Quote
View Public Profile Visit undoIT's homepage!
 
Old 06-18-2008, 06:54 PM Re: Centered Suckerfish Menu with Auto Item Width
vangogh's Avatar
Post Impressionist

Latest Blog Post:
Why Responsive Design?
Posts: 10,815
Name: Steven Bradley
Location: Boulder, Colorado
Trades: 0
I think I fully see the issue now. I'm not sure there's a good way to fix the font issue. I've used suckerfish on a few sites and yes if you resize the text some of the top level menu items want to drop to a second line as they exceed the width you set for the <ul>

It hasn't been an issue for the sites I've worked with. I think I've just left a little extra room so you can resize up once with the menu still working. At some point people will almost always be able to resize to things to where your page breaks. My goal is to keep the page together for a reasonable amount of increased font size.
__________________
l Search Engine Friendly Web Design |
Please login or register to view this content. Registration is FREE

l Tips On Marketing, SEO, Design, and Development |
Please login or register to view this content. Registration is FREE

l
Please login or register to view this content. Registration is FREE
|
Please login or register to view this content. Registration is FREE
vangogh is offline
Reply With Quote
View Public Profile Visit vangogh's homepage!
 
Reply     « Reply to Centered Suckerfish Menu with Auto Item Width
 

Thread Tools Search this Thread
Search this Thread:

Advanced Search

Posting Rules
You may not post new threads
You may not post replies
You may not post attachments
You may not edit your posts

BB code is On
Smilies are On
[IMG] code is On
HTML code is Off
Trackbacks are Off
Pingbacks are Off
Refbacks are Off





   
RSS Feed  Feeds: RSS   JS   XML
RSS Feed  Feeds for this forum: RSS   JS   XML



Page generated in 0.66245 seconds with 12 queries