Hello,

This is a CSS issue, not really related to Superfish or jQuery.

The solution depends on your code, and also on the browsers you want
to support (IE 6 and 7 will limit what you can do).

If your UL has a fixed width, you can center it horizontally in its
container using automatic margins.
<Insert search engine name> is your friend.
If the container has a fixed width too, using some padding or a margin
might do the trick too.

If the width of your UL element can't be predicted, it gets harder.
Using text-align:center won't work because your top-level LI are not
text, they are blocks, most probably floated blocks (i don't know what
your code looks like, but this is the most common solution). You can't
center blocks using text-align:center. You CAN center inline-block
elements, so it may be tempting to use display:inline-block on your
top-level LI (and no float), but IE 6-7 won't support that. Likewise,
using display:table-cell on your top-level LI elements is not an
option if you want to support IE 6-7.

So, if your series of top-level LI has an unknown, variable width,
you're stuck with:
1. A JavaScript solution that requires getting the container's width,
the UL's width, and add something like half the difference as a margin-
left or padding-left to the UL;
2. A CSS solution that relies on a display:table element wrapping your
UL (or display:table on the UL element itself). Elements that have a
table-like display CAN be centered using automatic margins, even if
they don't have an explicit width. And the one IE 6-7 compatible way
to have a table-like display is to use a TABLE element. So you would
need to wrap your UL in <table><tr><td>...</td></tr></table>, then use
automatic margins on that table element. Not nice, but it works.

Reply via email to