HighDots Forums  

Centered equal-width horizontal nav list CHALLENGE

Cascading Style Sheets Layout/presentation on the WWW (comp.infosystems.www.authoring.stylesheets)


Discuss Centered equal-width horizontal nav list CHALLENGE in the Cascading Style Sheets forum.



Reply
 
Thread Tools Display Modes
  #1  
Old   
Chris Beall
 
Posts: n/a

Default Centered equal-width horizontal nav list CHALLENGE - 01-18-2006 , 10:29 PM






Objective: Using an HTML list, create a horizontal nav menu with these
characteristics:

- All menu items have the same width at all times.
- When the window width is reduced, the menu items stack, rather than
creating a horizontal scroll bar.
- The menu cluster is always centered on the window.

See
http://pages.prodigy.net/chris_beall...al%20list.html

I've tried 4,238 permutations, without success. I'm beginning to
suspect it's impossible.

Oh, no JavaScript allowed, and HTML and CSS must validate...

Chris Beall


Reply With Quote
  #2  
Old   
Jim Moe
 
Posts: n/a

Default Re: Centered equal-width horizontal nav list CHALLENGE - 01-18-2006 , 11:21 PM






Chris Beall wrote:
Quote:
Objective: Using an HTML list, create a horizontal nav menu with these
characteristics:

- All menu items have the same width at all times.
- When the window width is reduced, the menu items stack, rather than
creating a horizontal scroll bar.
- The menu cluster is always centered on the window.

ul.menulist li p {
display: table-cell;
width: 10em;
margin: 0;
padding: 0;
}
and wrap the links in the <p> element:
<li><p><a href="#">Dummy1</a></p></li>

This has other issues but meets the stated requirements.

--
jmm (hyphen) list (at) sohnen-moe (dot) com
(Remove .AXSPAMGN for email)


Reply With Quote
  #3  
Old   
Chris Beall
 
Posts: n/a

Default Re: Centered equal-width horizontal nav list CHALLENGE - 01-19-2006 , 11:48 AM



Jim Moe wrote:
Quote:
Chris Beall wrote:

Objective: Using an HTML list, create a horizontal nav menu with these
characteristics:

- All menu items have the same width at all times.
- When the window width is reduced, the menu items stack, rather than
creating a horizontal scroll bar.
- The menu cluster is always centered on the window.


ul.menulist li p {
display: table-cell;
width: 10em;
margin: 0;
padding: 0;
}
and wrap the links in the <p> element:
li><p><a href="#">Dummy1</a></p></li

This has other issues but meets the stated requirements.

Jim,

In IE 6, this results in the menu items being stacked regardless of the
window width, i.e. it does not meet the objective of creating a
HORIZONTAL menu.

The 'other issue' that I notice is that in Firefox the border of each
item is offset below the text, so the top line of the border strikes
through the text. Although not stated as a requirement, I think this
makes this approach unacceptable.

I have added your attempt to the referenced page.

Anyone else care to try?

Chris Beall




Reply With Quote
  #4  
Old   
Spartanicus
 
Posts: n/a

Default Re: Centered equal-width horizontal nav list CHALLENGE - 01-19-2006 , 12:03 PM



Chris Beall <Chris_Beall (AT) prodigy (DOT) net> wrote:

Quote:
Anyone else care to try?
This issue has been dealt with, several of the regulars here have pages
up on this, search the archive (keywords "inline-block" and "centered").

--
Spartanicus


Reply With Quote
  #5  
Old   
Chris Beall
 
Posts: n/a

Default Re: Centered equal-width horizontal nav list CHALLENGE - 01-19-2006 , 04:19 PM



Spartanicus wrote:
Quote:
Chris Beall <Chris_Beall (AT) prodigy (DOT) net> wrote:


Anyone else care to try?


This issue has been dealt with, several of the regulars here have pages
up on this, search the archive (keywords "inline-block" and "centered").

Spartanicus,

I got 32 hits, including two references to pages you wrote. I've tried
to interpret what I read there and have added it to the demo page at
http://pages.prodigy.net/chris_beall...al%20list.html

It now works as well as can be expected in IE 6. There's an odd
border-position issue with Firefox (and NN 7.1) and Safari which I would
have to resolve. Any suggestions on that?

Chris Beall



Reply With Quote
  #6  
Old   
Chris Beall
 
Posts: n/a

Default Re: Centered equal-width horizontal nav list CHALLENGE - 01-19-2006 , 06:01 PM



Chris Beall wrote:

Quote:
Spartanicus wrote:
(snip)
This issue has been dealt with, several of the regulars here have pages
up on this, search the archive (keywords "inline-block" and "centered").

Spartanicus,

I got 32 hits, including two references to pages you wrote. I've tried
to interpret what I read there and have added it to the demo page at
http://pages.prodigy.net/chris_beall...al%20list.html

It now works as well as can be expected in IE 6. There's an odd
border-position issue with Firefox (and NN 7.1) and Safari which I would
have to resolve. Any suggestions on that?

Chris Beall

I've now determined that the border offset is related to line-height:
150%, which I had added to avoid vertical overlap of the menu items when
they were stacked. Removing this brings the text back inside the border
(but pressed hard against it at the top, except in IE). I've found no
twiddling of padding and margins that will center it in both Firefox and
IE, nor have I resolved the vertical overlap problem. I've added my
current attempt, with styling to match the intended final version, to
the demo page.

I am increasingly suspicious that my original objective is impossible to
meet. This is frustrating because the page is one that my daughter is
working on; it looked fine with a table layout (but menu entries would
not stack in narrow windows). I talked her into discarding tables and
using a list, but so far can't replicate the appearance of the original
table even in wide windows.

Chris Beall




Reply With Quote
Reply




Thread Tools
Display Modes

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

vB code is On
Smilies are On
[IMG] code is On
HTML code is Off



Powered by vBulletin Version 3.5.4
Copyright ©2000 - 2008, Jelsoft Enterprises Ltd.