How can I center the menu on my WordPress site? [duplicate]
I'm trying to get the menu on my WordPress site to align center.
I tried a bunch of things, including pulling out the float: left; CSS entry, but it won't work.
Can someone please help me?
Thanks a lot!
Remove float: left;
style and add this style:
ul#top-menu {
margin: 0 auto;
width: 425px; /*the menu width*/
}
Give #top-menu
an explicit width width: 450px
and margin: 23px auto 0 auto
;
Get rid of the float: left
.
Alternatively, make the li
elements inline blocks display: inline-block
and use text-align: center
on their parent.
ul#top-menu { margin-top: 23px; font-weight: bold; margin-left: auto; margin-right: auto; width: 420px;}
How about margin-left: 30%;? Just adjust it to be exactly centered...
精彩评论