Results 1 to 10 of 357

Hybrid View

  1. #1
    Join Date
    Sep 2008
    Location
    DownUnder, overlooking South Pole.
    Posts
    984
    Plugin Contributions
    6

    Default Re: Pure CSS Mega Menu

    Quote Originally Posted by jt3c View Post
    Well, I have it only on a local server at this point. Was just coming back to post that I spoke too soon and can't seem to center the menu items with margin or padding.
    Here's a screen shot if it'll help:
    Click image for larger version. 

Name:	menu1.jpg 
Views:	424 
Size:	18.3 KB 
ID:	12237
    Not sure that that came through.

    Anyway, in the css the "float: left;" in the following line is causing all links to justify to the left side of the menu bar.

    .mega-menu li {float:left;text-align:center;position:relative;margin:6px 20px 0px 0;border:none;}

    I want to center them. Can't float:center, so is there a way to do it some other way? As mentioned above I've messed with margins and padding in a variety of places but can't get the items to center on the bar with the same relative margins/padding amongst themselves. This would basically end up with roughly 300px to the left and right of the whole group of links and whatever is the default in relation to each other.

    Any help is greatly appreciated as I'm obviously still a relative noob.
    JT
    If I understand you correctly, you want to centre the entire menu within the header. I share your grief. So many bells and whistles but no sweet solution for this.

    One albeit messy and approximate way to do it is by editing the menu wrapper in stylesheet_mega_menu.css.

    #mega-wrapper {
    width: 980px; /*change 980px to an em value (eg 50em) that is only a few ems wider than the greatest width of your menu at various zooms. Applying an background colour will let you see the result. Too small a value and the menu may wordwrap.*/
    margin:0 auto; /* auto must remain as it centralises menu.*/
    display:block;
    position: relative;
    z-index:9999;
    background:#ff0; /* Optional. For checking width. Can be retained if desired. */
    padding-left:2em; /* this is the trick. Adjust this value until the menu looks near enough centred at various zooms. */
    }

    There are other ways to do this, (eg changing display:block; to display:table; etc) but I have yet to get them to work as desired.

    Hope this helps.

  2. #2
    Join Date
    Jul 2009
    Location
    picaflor-azul.com
    Posts
    6,928
    Plugin Contributions
    45

    Default Re: Pure CSS Mega Menu

    Quote Originally Posted by dw08gm View Post
    If I understand you correctly, you want to centre the entire menu within the header. I share your grief. So many bells and whistles but no sweet solution for this.

    One albeit messy and approximate way to do it is by editing the menu wrapper in stylesheet_mega_menu.css.

    #mega-wrapper {
    width: 980px; /*change 980px to an em value (eg 50em) that is only a few ems wider than the greatest width of your menu at various zooms. Applying an background colour will let you see the result. Too small a value and the menu may wordwrap.*/
    margin:0 auto; /* auto must remain as it centralises menu.*/
    display:block;
    position: relative;
    z-index:9999;
    background:#ff0; /* Optional. For checking width. Can be retained if desired. */
    padding-left:2em; /* this is the trick. Adjust this value until the menu looks near enough centred at various zooms. */
    }

    There are other ways to do this, (eg changing display:block; to display:table; etc) but I have yet to get them to work as desired.

    Hope this helps.
    One way to easily do this would be to add a margin-left to the .mega-menu li. You would need to play with the numbers until you get one that will center all of the links within the #mega-wrapper.

    Code:
    .mega-menu li {float:left;text-align:center;position:relative;margin-right:20px;margin-top:6px;margin-left:60px /*or whatever number of pixels works*/ ;border:none;}
    Thanks,

    Anne

  3. #3
    Join Date
    Feb 2009
    Location
    UK
    Posts
    1,303
    Plugin Contributions
    1

    Default Re: Pure CSS Mega Menu

    I'm attempting to add 'All Products' link to the bottom of the categories dropdown. I can achieve this by adding, in tpl_mega_menu.php, the all products link code like this:

    Code:
                <div class="dropdown_1column">
                    <div class="col_1 firstcolumn">
                       <div class="levels">
                           <?php
    
     // load the UL-generator class and produce the menu list dynamically from there
     require_once (DIR_WS_CLASSES . 'categories_ul_generator.php');
     $zen_CategoriesUL = new zen_categories_ul_generator;
     $menulist = $zen_CategoriesUL->buildTree(true);
     $menulist = str_replace('"level4"','"level5"',$menulist);
     $menulist = str_replace('"level3"','"level4"',$menulist);
     $menulist = str_replace('"level2"','"level3"',$menulist);
     $menulist = str_replace('"level1"','"level2"',$menulist);
     $menulist = str_replace('<li class="submenu">','<li class="submenu">',$menulist);
     $menulist = str_replace("</li>\n</ul>\n</li>\n</ul>\n","</li>\n</ul>\n",$menulist);
     echo $menulist;
    ?>                        
                       </div>   <a href="<?php echo zen_href_link(FILENAME_PRODUCTS_ALL); ?>"><?php echo HEADER_TITLE_ALL_PRODUCTS; ?></a>
                    </div>
                   </div>
    I'm having difficulty styling the link - applying inline css styling has no effect.

    Does anyone have an ideas or better suggestions?

  4. #4
    Join Date
    Feb 2009
    Location
    UK
    Posts
    1,303
    Plugin Contributions
    1

    Default Re: Pure CSS Mega Menu

    Quote Originally Posted by simon1066 View Post
    applying inline css styling has no effect.
    Now should read 'has limited effect'. I can change the size and colour - can't change 'ALL PRODUCTS' to 'All Products' even with text-decoration css.

    Can't help thinking the way I'm adding the link is a bit of a bodge.

  5. #5
    Join Date
    Jul 2009
    Location
    picaflor-azul.com
    Posts
    6,928
    Plugin Contributions
    45

    Default Re: Pure CSS Mega Menu

    Quote Originally Posted by simon1066 View Post
    I'm attempting to add 'All Products' link to the bottom of the categories dropdown. I can achieve this by adding, in tpl_mega_menu.php, the all products link code like this:

    Code:
                <div class="dropdown_1column">
                    <div class="col_1 firstcolumn">
                       <div class="levels">
                           <?php
    
     // load the UL-generator class and produce the menu list dynamically from there
     require_once (DIR_WS_CLASSES . 'categories_ul_generator.php');
     $zen_CategoriesUL = new zen_categories_ul_generator;
     $menulist = $zen_CategoriesUL->buildTree(true);
     $menulist = str_replace('"level4"','"level5"',$menulist);
     $menulist = str_replace('"level3"','"level4"',$menulist);
     $menulist = str_replace('"level2"','"level3"',$menulist);
     $menulist = str_replace('"level1"','"level2"',$menulist);
     $menulist = str_replace('<li class="submenu">','<li class="submenu">',$menulist);
     $menulist = str_replace("</li>\n</ul>\n</li>\n</ul>\n","</li>\n</ul>\n",$menulist);
     echo $menulist;
    ?>                        
                       </div>   <a href="<?php echo zen_href_link(FILENAME_PRODUCTS_ALL); ?>"><?php echo HEADER_TITLE_ALL_PRODUCTS; ?></a>
                    </div>
                   </div>
    I'm having difficulty styling the link - applying inline css styling has no effect.

    Does anyone have an ideas or better suggestions?

    If you post a link to your site I can take a look.

    It would be better to add the link inside a ul tag as a list item.

    Thanks,

    Anne

  6. #6
    Join Date
    Feb 2009
    Location
    UK
    Posts
    1,303
    Plugin Contributions
    1

    Default Re: Pure CSS Mega Menu

    Quote Originally Posted by picaflor-azul View Post
    If you post a link to your site I can take a look.

    It would be better to add the link inside a ul tag as a list item.

    Thanks,

    Anne
    By George you're right, just replacing my added code with

    Code:
    <ul> <li><a href="<?php echo zen_href_link(FILENAME_PRODUCTS_ALL); ?>"><?php echo HEADER_TITLE_ALL_PRODUCTS; ?></a></li></ul>
    seems to work perfectly.

    Thanks so much.

  7. #7
    Join Date
    Jul 2009
    Location
    picaflor-azul.com
    Posts
    6,928
    Plugin Contributions
    45

    Default Re: Pure CSS Mega Menu

    Quote Originally Posted by simon1066 View Post
    By George you're right, just replacing my added code with

    Code:
    <ul> <li><a href="<?php echo zen_href_link(FILENAME_PRODUCTS_ALL); ?>"><?php echo HEADER_TITLE_ALL_PRODUCTS; ?></a></li></ul>
    seems to work perfectly.

    Thanks so much.
    I am happy that it worked ;0

    Thanks,

    Anne

  8. #8
    Join Date
    Oct 2008
    Posts
    12
    Plugin Contributions
    0

    Default Re: Pure CSS Mega Menu

    Hi Anne,

    One quick question and I'm finished!!! Thanks to your help on here, I have now made a full width multiple Top Level dropdown which looks great!

    The final part is to only display categories and subs/sub subs that have an active product in them. I thought I'd seen it mentioned in this thread, but after half an hour of searching I can't see it.

    Thought I'd post a screenshot of the menu now, and will find some time to explain it for other soon.

    Hope you can help with the active categories only issue.

    Thanks a million

    KristianClick image for larger version. 

Name:	mega.jpg 
Views:	350 
Size:	43.8 KB 
ID:	13747

 

 

Similar Threads

  1. Help with Mega Menu css customization
    By swdynamic in forum Templates, Stylesheets, Page Layout
    Replies: 1
    Last Post: 17 Jul 2013, 01:21 AM
  2. v139h Mega Menu Mess
    By traytray in forum Templates, Stylesheets, Page Layout
    Replies: 1
    Last Post: 20 Nov 2012, 07:58 PM
  3. v150 Mega Menu assistance
    By Fancyfrills in forum Templates, Stylesheets, Page Layout
    Replies: 18
    Last Post: 24 Aug 2012, 06:16 PM
  4. Horizontal Drop Menu sort order of mega-menu
    By familynow in forum All Other Contributions/Addons
    Replies: 3
    Last Post: 19 Oct 2011, 04:39 PM

Posting Permissions

  • You may not post new threads
  • You may not post replies
  • You may not post attachments
  • You may not edit your posts
  •  
disjunctive-egg