473,698 Members | 2,672 Online
Bytes | Software Development & Data Engineering Community
+ Post

Home Posts Topics Members FAQ

Centered equal-width horizontal nav list CHALLENGE

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

Jan 19 '06 #1
5 4552
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.

--
jmm (hyphen) list (at) sohnen-moe (dot) com
(Remove .AXSPAMGN for email)
Jan 19 '06 #2
Jim Moe wrote:
Chris Beall wrote:
Objective: Using an HTML list, create a horizontal nav menu with these
characteristi cs:

- 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
Jan 19 '06 #3
Chris Beall <Ch*********@pr odigy.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
Jan 19 '06 #4
Spartanicus wrote:
Chris Beall <Ch*********@pr odigy.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

Jan 19 '06 #5
Chris Beall wrote:
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
Jan 20 '06 #6

This thread has been closed and replies have been disabled. Please start a new discussion.

Similar topics

8
11093
by: Freek te Water | last post by:
Hi, Hope no-one is offended by my probably noob question... Context: I have a web page design, which always centres in the middle of the screen (using a 100%*100% HTML-table). Now I also use layers, that get visible when something is clicked. All works fine. Problem:
4
9727
by: Mimo Zus | last post by:
I'm hoping that someone can explain what's going on; better yet provide a workaround. I'm designing a centered CSS site based on a 550 pixel wide vertical background image. Onto this background I built a two column layout with nested navigation and content divs. The background image is centered via "background: ... center;", the divs are centered over it via "margin: 0 auto 0 auto;". The problem I'm having in IE6 is inconsistent...
4
1731
by: yawnmoth | last post by:
The buy behind the csszengarden has a tutorial on how to center absolutely positioned elements. Here's the last example: http://www.mezzoblue.com/tests/centered-css/ex5.html I've tried replacing the text with three divs of different colors floated next to one another to no avail: http://www.frostjedi.com/terra/dev/test.html
17
6882
by: No One | last post by:
Is there a way to keep a control centered inside a form without having to recalculate everytime the form is resized?
3
1352
by: Ryan Wade | last post by:
If the user resizes IE I want the webform controls to be automatically repositioned in the center of the form. How can I accomplish this? Ryan
4
2656
by: Austin Powers | last post by:
I want to (on one line) show something like the following ------------------------------------------------------- left centered right ------------------------------------------------------- If I use <hrto draw the lines, then there is too much space between the line and the text If I use a table, then how do I get the right-justified string to be at the
6
2225
by: hiervision | last post by:
Hi I have a question about a CSS menu. I've got a 700 pixel table centered in the body of my page. The table scrolls quite a ways down. I would like to place a menu flush against the right side of that table, centered vertically, which does not move when the user scrolls down. Obviously, it would need to stay flush against the centered table as it is resized in either
9
2518
by: Troy Piggins | last post by:
If I use the code: ----- <div style="text-align: center;"> <a href="photos.php?img=xx1.jpg"> <img src="xx1.jpg" style="padding: 10px;" /> </a> <a href="photos.php?img=xx2.jpg">
3
2454
by: Tobi Hammert | last post by:
i have a page that shows a random picture, centered. how do i create a layer that stays centered, but always 300 px down from the top? to make it clear again: i want to place a text layer, x=centered, y=300. is it even possible, or do layers have get absolute positions?
3
2315
by: gentsquash | last post by:
I'm trying to display a paragraph that has a centered phrase, such as this one, in the middle of the paragraph. An example is the section "End of semester project" on my course-page http://www.math.ufl.edu/~squash/course.calc3.html
0
8603
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
9023
jinu1996
by: jinu1996 | last post by:
In today's digital age, having a compelling online presence is paramount for businesses aiming to thrive in a competitive landscape. At the heart of this digital strategy lies an intricately woven tapestry of website design and digital marketing. It's not merely about having a website; it's about crafting an immersive digital experience that captivates audiences and drives business growth. The Art of Business Website Design Your website is...
1
8893
by: Hystou | last post by:
Overview: Windows 11 and 10 have less user interface control over operating system update behaviour than previous versions of Windows. In Windows 11 and 10, there is no way to turn off the Windows Update option using the Control Panel or Settings app; it automatically checks for updates and installs any it finds, whether you like it or not. For most users, this new feature is actually very convenient. If you want to control the update process,...
0
8861
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
5860
by: conductexam | last post by:
I have .net C# application in which I am extracting data from word file and save it in database particularly. To store word all data as it is I am converting the whole word file firstly in HTML and then checking html paragraph one by one. At the time of converting from word file to html my equations which are in the word document file was convert into image. Globals.ThisAddIn.Application.ActiveDocument.Select();...
0
4366
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
4615
by: adsilva | last post by:
A Windows Forms form does not have the event Unload, like VB6. What one acts like?
1
3045
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
1999
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.