SP2010 Branding Tip #7 – Using Simple Rendering in SharePoint Navigation 3

One of the really cool enhancements in SharePoint 2010 is the addition of the UseSimpleRendering property to the control. When UseSimpleRendering is set to True, the SharePoint navigation menu is rendered using a cleaner unordered HTML list. Here is a sample of what the new HTML looks like when you view source:

  •     href=”http://www.google.com”>
       
          Heading
       

     
     

  • As you can see this is much cleaner than the old Table structures that were used in SharePoint 2007. When I set out to style this new HTML it took me a bit to parse through the out of the box CSS to determine the best way to tackle it. Here is a commented version of the CSS classes that I used to style the new simple rendered top navigation:

    /* item style */
    .s4-tn li.static > .menu-item {
    }

    /* item style hover */
    .s4-tn li.static > a:hover {
    }

    /* flyout holder */
    .s4-tn ul.dynamic {
    }

    /* flyout item */
    .s4-tn li.dynamic > .menu-item {
    }

    /* flyout item hover */
    .s4-tn li.dynamic > a:hover {
    }

    For the most part you can take your old styles from the SharePoint 2007 navigation and apply them here (with some modification to account for cleaner HTML).

    What if you want to hide the little arrows that appear next the navigation items that have flyouts (dynamic display levels)? Here is the CSS I used to hide them:

    /* hide arrows for top level items with flyouts */
    .menu-horizontal a.dynamic-children span.additional-background,
    .menu-horizontal span.dynamic-children span.additional-background{
        padding-right:0px;
        background-image:none;
    }

    After some trial and error I was able to duplicate the current SharePoint 2007 top navigation for SharePoint911 using the Simple Rendering:

     

    image

     

    One last note, if all of this new cleaner HTML scares you and you don’t want to spend the time to convert your old CSS to work with the new Simple Rendering, you can always turn it off by setting UseSimpleRendering=”False” in the control. With this set to false, the old less clean Table based navigation is used and all of your old CSS styles should work perfectly in SharePoint 2010.

    3 thoughts on “SP2010 Branding Tip #7 – Using Simple Rendering in SharePoint Navigation

    1. Reply Ganesh Oct 15, 2010 12:00 am

      Hi,There seems to be a problem while using the flyouts menu styles that you have specified here.When there is subsite displayed in the flyouts which has a large name such as Corporate Professional services the hover styles do not apply properly.I solved it by making the width of the flyouts menu items fixed and the hover width to 90%.I feel there must be a better way to solve the isuue.Any tips would be helpful.Thanks.

    2. Reply Thiago Silva Feb 25, 2011 6:52 pm

      Randy, we’ve successfully implemented Simple Rendering Mode for the AspMenu, after struggling to style the menu for cross-browser compatibility with the old rendering mode.

      However, two properties that used to be applied (and which we relied on), DynamicVerticalOffset and DynamicHorizontalOffset, are no longer being respected.

      We need to shift our left nav menu up and over a bit, and I am not sure if that’s something that we can control in SimpleRenderingMode.

      Do you have any insight into that?

    3. Reply eureka Jul 29, 2011 4:36 pm

      Hey Randy, wondering if you have ever come across this issue…

      I have a client who wants to use the old table formatted navigation so we can attach background images using the unique ID for each table row. That’s fine, and I have the navigation set up using:
      UseSimpleRendering=”false” UseSeparateCss=”false”
      Orientation=”Vertical”

      SO – the weird thing is… on settings.aspx the markup it goes back to an being an unordered list.

      Have you ever seen this before?

    Leave a Reply