How do I center align horizontal <UL> menu?
Posted
by Steven
on Stack Overflow
See other posts from Stack Overflow
or by Steven
Published on 2010-05-19T12:21:51Z
Indexed on
2010/05/19
13:00 UTC
Read the original article
Hit count: 171
I need to centre align a horizontal menu.
I've tried various solutions, including the mix of inline-block / block / center-align etc., but not being successful.
Can someone help me please? :)
Here is my code:
<div class="topmenu-design">
<!-- Top menu content: START -->
<ul id="topmenu firstlevel">
<li class="firstli" id="node_id_64"><div><a href="#"><span>Om kampanjen</span></a></div></li>
<li id="node_id_65"><div><a href="#"><span>Fakta om inneklima</span></a></div></li>
<li class="lastli" id="node_id_66"><div><a href="#"><span>Statistikk</span></a></div></li>
</ul>
<!-- Top menu content: END -->
</div>
UPDATE
I know how to center align the UL within the DIV. That can be accomplished using Sarfraz's suggestion. But the list items are still floated left within the UL.
Do I smell javascript to accomplish this?
© Stack Overflow or respective owner