开发者

How can I center the menu on my WordPress site? [duplicate]

开发者 https://www.devze.com 2023-03-13 13:28 出处:网络
This question already has answ开发者_运维技巧ers here: How to centre my CSS menu? (4 answers) Closed 9 years ago.
This question already has answ开发者_运维技巧ers here: How to centre my CSS menu? (4 answers) Closed 9 years ago.

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...

0

精彩评论

暂无评论...
验证码 换一张
取 消