We launched new forums in March 2019—join us there. In a hurry for help with your website? Get Help Now!
    • 4980
    • 26 Posts
    would like to center the muddy dog paws dropdown menu. anyone have a solution to center the ul for the menu within a div?

    thanks! chas
      • 4310
      • 2,310 Posts
      I tried and failed with margin etc. in the end I just added some padding left to the main <ul>.
      Someone else might have a fix.
        • 4980
        • 26 Posts
        that is where i started and where i ended up after sifting through a lot of posts about centering ul’s in divs - didn’t find much help! am hoping someone has a little more elegant solution.
          • 25663 MODX Staff
          • 12,272 Posts
          Horizontal centering of ULs can be a really tough nut to crack indeed. There’s so many variations of what you’re trying to achieve. Here’s one that appears to work though:

          http://css.maxdesign.com.au/listutorial/horizontal_master.htm
            Ryan Thrash, MODX Co-Founder
            Follow me on Twitter at @rthrash or catch my occasional unofficial thoughts at thrash.me
            • 4980
            • 26 Posts
            looks like that would work in simple situations. tried applying the technique both outside the menu and within the dropdown menu. seems there are some other "forces" at work within the css for the menu itself that complicate the issue. the closest i can get is centered in a vertical list. any horizontal layout has the ul claiming 100% of it’s container. *sigh* unfortunately, my css skills are not at the same level as the menu and so far trial & error has not gotten me to a centered menu.

            thanks for the suggestions.
              • 25663 MODX Staff
              • 12,272 Posts
              ULs are block elements by definition and unless given explicit widths will take 100% of the width of their containing element.

              CSS is both incredibly simple and incredibly deep. Kinda like MODx!
                Ryan Thrash, MODX Co-Founder
                Follow me on Twitter at @rthrash or catch my occasional unofficial thoughts at thrash.me
                • 15976
                • 44 Posts
                Has anybody had any success with this?
                  • 25551 ☆ A M B ☆
                  • 1,231 Posts
                  I’m not entirely sure if I understand what you are trying to do...

                  style="margin:0px auto" is one way to center elements, another is style="text-align:center" (yes this does work for than just text) or have you tried creating a further div around the menu and using one of the 2 styles for that div to force the elements within, to center?
                    Ross Sivills - MD AugmentBLU Edinburgh, Scotland UK
                    AugmentBLU - MODX Partner

                    BLUcart - MODX Revolution E-Commerce & Shopping Cart