Center menu items

Posted in: Newspaper
Post count: 91

Hi, first of all: Great theme!

How do I center the (sf-)menu items, while keeping the home and nav button (the one to the right of the home button) left-aligned?

In other words, in the example below, I want to keep the home button and the nav button where they are, while center-aligning “lifestyle” “phones” etc..

Thanks for helping me out!

Post count: 854

hi,
the menu is made with <li> elements.
you can move all of theme using:

.menu-header-container {
    display: table;
    float: none !important;
    margin-left: auto;
    margin-right: auto;
}

here : http://screencast.com/t/2pdgwMm0TUN

in Advance CSS you can use this css only on certain devices.

Thanks for you message.
Radu A.

Post count: 91

Yes, that moves all the menu items, which I’ve already tried.

My question: How do I center the menu items I mentioned, while keeping the ones I specified left-aligned? I know this can be achieved by mentioning their ID in custom CSS, but how?

Thanks,
Are

Post count: 3343

Hi,
You can’t via CSS.

1.

            <div class="row-fluid td-menu-header">
                <div class="span3 hide-mobile">
                    <?php

                    wp_nav_menu(array(
                        'theme_location' => 'my-menu',
                        'menu_class'=> 'sf-menu',
                        'fallback_cb' => 'td_wp_page_menu',
                        'walker' => new td_tagdiv_walker_nav_menu()
                    ));

                    ?>
                </div>

like here: http://screencast.com/t/BqiMkB5Sb

2. 'my-menu' => __( 'My Menu', TD_THEME_NAME)
like here: http://screencast.com/t/2bVntzFIS5Q

3. Add this CSS in theme panel -> Custom CSS

@media (max-width: 767px) {
    .span3.hide-mobile {
        display: none;
   }
}
.hide-mobile {
    padding-left: 15px;
}
.td-menu-wrap #td-top-menu {
    padding-left: 0px;
}
@media (min-width: 1200px) {
    .hide-mobile {
       padding-left: 48px;
    }
}
.td-menu-header .span8 {
    margin-left: 0px;
}
.menu-header-container {
    display: table;
    float: none !important;
    margin-left: auto;
    margin-right: auto;
}

4. Go to Appearance -> Menu
Use this menu for that 2 icons and header menu for the rest of the menu.

Result: http://screencast.com/t/XmkHInjHHvv

Thanks!

Post count: 91

Almost got it. Followed all your steps, but it doesn’t look completely centered:

I decided not to keep the “home” house/button. Maybe that’s what messed it up? How do I make the items completely centered?

Post count: 854

hi,
there are 2 pixel on the right side of the menu : http://screencast.com/t/tKcvV72f0

use this css :

#menu-hovedside{
   padding-left: 1px;
}

here: http://screencast.com/t/quwcmwxeCH

will become : http://screencast.com/t/DtYdqY3v

Thanks for you message.
Radu A.

Post count: 91

Hi

Your screencast is from my live site (.no), not the one I’m working on (.dev – only visible locally)…

Post count: 91

This still isn’t fixed… See my comment above (#post-8889).

Post count: 3343

You can align it by changing some padding to align it. I need to see the site live to inspect it.

Do you have CSS knowledge? to make it?

Thanks!

Post count: 91

I have some knowledge, but it would be helpful with a few pointers. Would something like this work (with the appropriate menu item # and positioning)?

.menu-item-37076 {
position: absolute; left: 260px;}
}

Post count: 854

hi,

this css :

.menu-item-37076 {
  position: absolute; left: 260px;}
}

will make the tag with the class ‘menu-item-37076’ to always have the distance from left side of the screen 260px. I think using css padding or margin rule in what you need, like:

#menu-hovedside{
   padding-left: 1px;
}

here is some doc about padding : http://www.w3schools.com/css/css_padding.asp

Post count: 91

Ok. The name of the menu I’m trying to move to the right: “Hoved (Header Menu (main))”

This CSS doesn’t move the menu (I’ve tried changing the px):

#menu-hoved{
padding-left: 1px;
}

Post count: 3343

Hi,
Give us your site link to inspect it and make the right CSS.

Post count: 91

It’s developed locally, so that’s not possible. Sorry.

But you must have a easy way to left-align, center or right-align your menu?

Post count: 3343

Hi,
The solution provided above work for me https://forum.tagdiv.com/topic/center-menu-items/#post-8832

Leave it and when the site is live reply us and we will provide you a CSS
Thanks!

Post count: 91

Website is finally online (www.amerikanskpolitikk.no), behind password wall. Send me an e-mail and I’ll give it to you.

I have an issue with the menu_category (the item on the far left side in the pics above). I’m given the opportunity “Click here – to select or create a menu”, but nothing happens when I try changing it.

Are

Post count: 3343

Hi,
Go to Appearance -> Menus -> Manage locations and see if you have set a menu for each section.

Send the details via email at contact@tagdiv.com
Thanks!

Viewing 17 posts - 1 through 17 (of 17 total)
The forum ‘Newspaper’ is closed to new topics and replies.