WordPress.org

Ready to get started?Download WordPress

Forums

[Twenty Twelve Theme ] Center Align Items Main Menu (5 posts)

  1. Design Locker
    Member
    Posted 1 year ago #

    Hi All,

    The main navigation menu on wordpress twenty twelve theme is left aligned by default.

    I am trying to center align the menu on my child theme but just cannot figure it out. The "li" items currently align left and I want them to align center within the main nav bar. Any suggestions?

    Site is http://www.inmotionphysio.ie/wip

  2. esmi
    Forum Moderator
    Posted 1 year ago #

    I'd suggest applying the background colour to the menu's enclosing div and then applying a fixed width to the menu ul itself along with margin:0 auto;;

  3. Andrew
    Forum Moderator
    Posted 1 year ago #

    You may run into formatting issues for Firefox, but you could instead apply to your <ul> element;

    display: table;
    margin: 0 auto;

    And not specify a width.

  4. Design Locker
    Member
    Posted 1 year ago #

    Hi, thanks for the replies.

    I tried adding

    display: table;
    margin: 0 auto;

    to both ".main-navigation ul.nav-menu" & ".main-navigation ul" but unfortunately no luck.

  5. Andrew
    Forum Moderator
    Posted 1 year ago #

    As you're already displaying a width, you might as well do Esmi's method.

Topic Closed

This topic has been closed to new replies.

About this Topic