• Resolved pullman

    (@pullman)


    Ok here goes – I have a CSS menu in the footer on https://philipus.com. Hovering on the link ‘Galleries’ brings up a horizontal submenu.

    I have managed to center the first level of the menu (Start Galleries Projects etc) by setting an appropriate width of #navigation ul li.

    Now to the problem — I can’t figure out how to center the sublevel. The width of the elements in that part of the menu is governed by the width of #navigation ul li as well.

    How can I fix this so that both levels of the menu appear centered on the page?

    Thanks a million in advance for this, I really appreciate it.
    /p

Viewing 9 replies - 1 through 9 (of 9 total)
  • On style.css line 51 #navigation li ul
    change left: 281; to left: 254px; and it will look pretty centered.

    Also, it’s a good idea title your post with a description of the problem, then say Gaah in your post ??

    Thread Starter pullman

    (@pullman)

    Thank you so much for this. I appreciate it a lot.

    Here’s a brief follow-up question.

    I have made another submenu, above the Wallpapers link. Now this one is completely to the left. Is there a way to have separate positioning for two submenus?

    EDIT: Perhaps there’s a way in CSS to define a class or something for that second menu?

    And your point about the title is well taken too ??

    Kind regards and thanks for taking the time to reply
    Philip

    Sure thing.
    If you go into Appearance > Menus and click the screen options tab up in the top right corner you’ll see a checkbox under ‘advanced menu properties’ check ‘CSS Classes’

    Then go ahead and add a class to the ‘Wallpapers’ menu item. Once that’s in place you can do:

    #navigation li ul.wallpaper {
         left: 340px;
    }

    Make sure you add this new css rule beneath the original #navigation li ul.

    Let me know if this works for you.

    Thread Starter pullman

    (@pullman)

    Wow this is great – you’re helping me solve an issue I’ve tried with for over a year.

    The tiny problem is that I don’t use the WP Dashboard for the menu. I sort of typed it together myself with the help of the net.

    I have added the new class to style.css like this (and placed it immediately below original #navigation li ul):

    #navigation li ul.wallpaper {margin:0; padding:0 5px; display:none;position:absolute;left:340px; top:-3px;background-color:#fff;}

    Where I stumble now is how to link the class to the code in footer.php. This is the code:

    <li>
              <a href="https://philipus.com/wallpapers">WALLPAPERS</a>
                   <ul>
                          <li.wallpaper><a href="https://philipus.com/wallpapers-wildlife">WILDLIFE</a></li.wallpaper>
                          <li.wallpaper><a href="https://philipus.com/wallpapers-nature">NATURE</a></li.wallpaper>
                          <li.wallpaper><a href="https://philipus.com/wallpapers-iphone">iPHONE</a></li.wallpaper>
                    </ul>
                </li>

    Not sure if that’s how to connect to the wallpaper class. What happens is that the Wallpaper submenu appears vertical and to the left.

    Thanks for your continued help, I am super grateful
    Philip

    No problem at all, this is what the WordPress community is all about ??

    Your css looks fine but you’ll want to add your wallpaper class to the ul instead of each li, that should fix it up for you.

    Thread Starter pullman

    (@pullman)

    Happy continuation on the Christmas (as we say in Sweden) and thanks very much for your reply.

    I think I’ve stumbled upon a problem. I added the wallpaper class to the ul, but now the submenu items show next to the main (first-level) menu items.

    <a href="https://philipus.com/wallpapers">WALLPAPERS</a>
                   <ul.wallpaper>
    
    <li><a href="https://philipus.com/wallpapers-wildlife">WILDLIFE</a></li>
    <li><a href="https://philipus.com/wallpapers-nature">NATURE</a></li>
    <li><a href="https://philipus.com/wallpapers-iphone">iPHONE</a></li>
                    </ul.wallpaper>

    It is as if display=none doesn’t work on the Wallpaper submenu. It is odd, because the CSS of the Wallpaper submenu is identical to that of the Galleries submenu.

    What could be wrong?

    Hej!
    Merry continuation on Christmas to you as well – sorry that’s the only Swedish word I know ??

    You’re getting your HTML and CSS syntax mixed up a little. To add the wallpaper class to your ul try this:

    <ul class="wallpaper">
    <li><a href="https://philipus.com/wallpapers-wildlife">WILDLIFE</a></li>
    <li><a href="https://philipus.com/wallpapers-nature">NATURE</a></li>
    <li><a href="https://philipus.com/wallpapers-iphone">iPHONE</a></li>
    </ul>

    You don’t need to add the class again in the closing tag, just the first one. But in your CSS file you will put .wallpaper

    Hope that helps!

    By the way – great pictures!

    Thread Starter pullman

    (@pullman)

    Thanks for the compliment! I appreciate it.

    You have solved the most tricky thing I’ve had to struggle with on the site since I redesigned it over a year ago. I can’t tell you how incredibly grateful I am. Thank you so very much! I’m absolutely thrilled to have this sorted finally (and I’ve learnt a lot in the process, too). Thanks also for your patience and for following this until the conclusion.

    All the best
    Philip

    You’re welcome and very glad I could help.

    Best of luck with the site!

Viewing 9 replies - 1 through 9 (of 9 total)
  • The topic ‘Gaah, how do I do this?’ is closed to new replies.