In article <kldrq9$5bb$
1...@news.albasani.net>,
Tuxedo <
tux...@mailinator.com> wrote:
> Tuxedo wrote:
>
> > it's safe to conclude that with lists it is next to impossible to make
> > both situations of multiline center and drop-menu positioning work well
> > and that it's therefore better to stick to float:left in combination with
> > left:auto for reliable hover drop menu positioning, which will of course
> > cause new lines of the top-level list items to align their words flush to
> > the left margin of the area that the whole list occupies.
>
> One way to center multiline wrapped content can be achived with tables
> displayed inline, horizontally next to each other, in a text-align:center
> block (eg. body) and including a <span>section</span> within for the
> dropdown content. It's the only way I've found it possible to center text
> links including multiple lines while also having the drop menus appear in
> the right places below each relevant top level link:
>
...
> body{
> text-align:center;
> }
>
> .outer{
> border: 1px solid orange;
> display: inline;
> white-space:nowrap;
> }
>
> td{
> background: white;
> }
>
> .inner{
> border: 1px solid yellow;
> position:absolute;
> left: -999em;
> display: block;
> }
>
> .outer:hover span{
> left: auto;
> }
> </style>
> </head>
>
> <body>
>
> <table class="outer"><tr><td>
> Toplink 1.0
> <span class="inner">
> Dropdown 1
> </span>
Your markup does not get the top level lines to be horizontal, this is
surely one of your original and crucial requirements. There is no big
problem getting dropdowns to drop under their top link in the normal
float way.
The problem I thought you were having is getting reliable
* horizontal menu
* that centres
* whose menu items wrap on narrow viewport
* whose dropdowns drop under the relevant top level items
Before going on, a few things: consider that it might look better to
visitors and be more naturally predictable to have the default left
alignment when the top levels wrap; when the dropdowns appear, the
whole arrangement is easier to understand.
It is a good idea to have a suitably contrasting *background-color* to
the dropdowns so that, especially if there is top level wrapping, they
don't look so odd as they appear and overlay wrapped top level text.
Plus if there is content text under the menu (as there often is), the
darker (or generally some *contrasting*) colour helps delineate the
sub menu.
Also consider making the top level menu items links themselves.
Actually this is very important for userability. People can then use
your menu without relying n the dropdowns functioning, the sub menu
links should then appear as a strip of top level nav on the
destination pages.
Here is one possible design that gets all of the above criteria at
least in browsers I have tested. Opera throws a little impatient fit
on narrow viewports and simply displays the whole shebang, ie,
displays all the levels at once, no hovering needed, maybe not so
pretty! But I like its honesty!
<
http://tinyurl.com/c49lxzf>
(Curiously, when the CSS is checked under a menu item in Firefox
called Tools on a Mac, it flags the display: inline-block as an error.
The same validator (
jigsaw.w3.org/), approached directly with the
relevant url of dropdown test has no such objection).
I don't recommend anything like my above btw, keep it simpler I think.
--
dorayme