Recent
Apps
SharePoint 2013

Ribbon Customization: Changing Placement, Look and Behavior

* Note: This post was created with SharePoint 2010 Beta and might be a little off. Just keep that in mind!

One of the biggest features of SharePoint 2010 is the Office Ribbon. Whether you love it or hate it, it’s here to stay and eventually you will be faced with the choice of including the ribbon within your site branding. What can be edited and changed in the ribbon? Microsoft spent millions, if not billions of dollars to research and develop the ribbon so how much should we change?

Just because we can…does it mean we should?

I was recently at a meeting with one of our clients and a Microsoft rep. The client was having a hard time grasping the concept of the SharePoint Ribbon and its role in editing, administering and browsing a site.  The discussion went back forth. Eventually everything was sorted out but it got me thinking…the new ribbon is quite the mental hurdle and this discussion is bound to repeat itself as 2010 adoption grows.

I also realized the impact that the ribbon is going to have on branding. With SharePoint 2007, if you had the skills, you could essentially make SharePoint look any way your heart desired. As long as you included the “site actions” and other essential one click menus you could design and layout SharePoint as you wished.

In SharePoint 2010, the ribbon is static at the top the screen and it never scrolls. It plays a massive part in usability and administration. I am always on the quest to customize SharePoint to a point beyond recognition, but how far can I alter the ribbon?

My Mission: To brand a 2010 site to my hearts content AND alter the look and feel of the ribbon making sure that it retains all previously established functionality and usability.

The Rules: Just using CSS, Javascript and a custom Master Page. No Server Side Code. I’m not adding functionality. I’m just altering the look and feel.


The Design:
Whoa!  What did I do?! The ribbon isn’t at the top! What’s the reason for this? Well… I wanted to put more emphasis on the sites title and navigation; separating the two. This will allow my creativity to flourish because the ribbon is now it’s own entity. I can now focus on the design of the site as if it were a typical website; not having to worry about about my design functionality and its ability to mesh with the fixed ribbon on the top.

This image illustrates how I have removed the content from the “browse” tab and made it static, above the ribbon. If you were to click the browse button the ribbon will now just collapse.

As far as the design of the ribbon goes, I have just changed the colours, added the ruler background and rounded the corners all in an effort to align it with the look and feel I have chosen for the rest of the site.

Changing the Position of the Ribbon: I know that changing the placement of the ribbon seems like a daunting task, but in reality it’s just the tabs and actions of the ribbon in two controls. There are other items in the default ribbon and they do include the nav and title but once you understand what each control does, it’s not hard to pick it apart and move the pieces around.

Here is a breakdown of the essential controls laid out to better understand how it all works:

1 . <SPRibbon PlaceholderElementId=”RibbonContainer”>
2 . <SharePoint:SPRibbonPeripheralContent Location=”TabRowLeft”>
3 . <SharePoint:SiteActions>
4 . <asp:ContentPlaceHolder id=”PlaceHolderGlobalNavigation”>
<SharePoint:PopoutMenu ID=”GlobalBreadCrumbNavPopout”>
<SharePoint:PageStateActionButton>
5 . <SharePoint:SPRibbonPeripheralContent Location=”TabRowRight”>

To move the pieces, we want to the correct zone so we simply move the following areas:

The Following code can be placed anywhere in your master page to change the location of the ribbon tabs and action icons.

<SharePoint:SPRibbon
runat="server"
PlaceholderElementId="RibbonContainer"
CssFile="">
<SharePoint:SPRibbonPeripheralContent
runat="server"
Location="TabRowRight"
ID="RibbonTabRowRight"
CssClass="s4-trc-container s4-notdlg">
</SharePoint:SPRibbonPeripheralContent>
</SharePoint:SPRibbon>

Changing how the Ribbon looks: Just like any SharePoint branding it takes time and patience. To style the ribbon, I created a set of styles to work with the html that the SPRibbon Controls output. These styles are loaded last and override the initial default styles. In addition to these, I have used 3 background images to attain my design.


/* Removes the original background from the ribbon */
body #s4-ribboncont{
background-image:none;
margin-top:10px;
}

/* Globally set all the background colors to transparent and remove background images / borders */
#s4-ribbonrow,
#s4-ribbonrow *
{
background-color:transparent !important;
background-image:none;
border-width:0px;

}
.s4-ribbonrowhidetitle{
height:inherit !important;
}
/* After globally turning off borders.. turn back on the separators for the large icons*/
.ms-cui-groupSeparator {
border-right:1px solid #E7E7E8 !important;
}
.ms-cui-topBar2{
border-width:0px;
}

/* Set the background for the tabs at the top (Browse / Page) */
.ms-cui-ribbonTopBars{
background:url('../img/ribbon-top.png') no-repeat !important;
padding-top:0px;
padding-bottom:5px;
}

/* Set the background for the bottom part of the ribbon */
.ms-cui-tabContainer{
background:url('../img/ribbon-bottom.png') no-repeat !important;
padding-bottom:5px;
position:relative;
top:-6px;
}

/* Set the background for the additional dynamic tabs (Web parts / Lists ect) */
.ms-cui-cg-i{
background-image:url('../img/ribbon-tab.png') !important;
background-position:bottom left;
background-repeat:no-repeat !important;
height:20px;
margin-bottom:2px;
}
.ms-cui-cg-db .ms-cui-cg-t{
height:17px;
background-image:url('../img/ribbon-tab.png') !important;
background-position:bottom right !important;
background-repeat:no-repeat !important;
margin-left:4px;
}
.ms-cui-cg-t-i{
color:white;
font-weight:bold;
}
.ribbon-wrapper{
position:relative;
}

/* For use with the next step! read on! */

.fixed-ribbon{
position:fixed;
top:0;
width:950px;
z-index:21;
}

Have a look at the background images to give you an idea how I did it.

ribbon-top.png
ribbon-bottom.png

Changing how the Ribbon behaves: Now that I have the ribbon in the correct location and it’s styled to my liking, I have one last step. The ribbon was designed to always be visible. That’s why it’s fixed at the top of the screen. An example of this would be a content editor web part at the bottom of a page. You scroll down to the bottom but the controls to edit, change fonts and add links are in the header and would not be visible. I have now taken the ribbon from the fixed position at the top of the screen and have included it in the master page as a relative HTML box that scrolls.

With some jQuery we can overcome this inherent problem by toggling the ribbon to become fixed when the page scrolls to a position where the ribbon would be out of the viewable area.
*Note: This assumes that the ribbon has been placed in a custom div with the class of “ribbon-wrapper”

// This is written in jQuery.
// This piece of code will toggle the ribbon from a fixed position to a relative position based on the viewable area in the browser

// When the Window Scrolls
$(window).scroll(function () {

// The Current Window in an object
var jWindow = $(window);

// If the Ribbon is turned on...
if(hideRibbon != true)
{

//If the top of the page is over 145 pixels scrolled then...
if(jWindow.scrollTop() > 145)
{

// Set the height of the ribbon box and toggle it to fixed.
$(".ribbon-wrapper").css("height", $("#s4-ribbonrow").height() + "px");
$("#s4-ribbonrow").addClass("fixed-ribbon");

}

//If the top of the page is less than 145 pixels scrolled then...
else if(jWindow.scrollTop() < 146)
{

// Remove the set height and toggle it back to relative
$("#s4-ribbonrow").removeClass("fixed-ribbon");
$(".ribbon-wrapper").removeAttr("style");

}
}

});

Last but not least, since I have now removed the title from being displayed in the ribbon when “browse” is selected, let’s collapse the ribbon to only show the tabs.


// If there aren't any buttons in the ribbon don't display the box.
hideRibbon = true;

// The the Ribbon is loaded in the DOM
$("#RibbonContainer").ready(function(){

// Loop through the children of the ribbon icons. And if you find a child, set the flag to false.
$("#s4-ribboncont .ms-cui-tts li").each(function(){
hideRibbon = false
});

//If the flag was never triggered (no icons were found) then hide the ribbon box.
if(hideRibbon)
{
$("#s4-ribbonrow").hide();
}
});

Conclusion: Branding the ribbon is not for the faint of heart. As you can see it takes a lot of time and effort. I know that the ribbon was never meant to be branded or moved but I really do think that we can’t fully establish a custom look and feel until everything has been branded.

Being able to change the location and design of the ribbon to a safe level of customization will satisfy those of us on the eternal quest to make SharePoint our own…for ourselves and for our customers.

71 Responses to “Ribbon Customization: Changing Placement, Look and Behavior”

  1. Tobias Zimmergren Says:

    Looking good!

  2. Wes Turner Says:

    Great Post!

    A quick question for you and perhaps a good subject for a brief blog; I want to just show the and the near my site logo, then hide the ribbon so it doesn’t take up any space on the page. Have you any idea how I might go about this?

  3. Robin Says:

    Looks very good indeed! Damn! :)

  4. chrissmac Says:

    this looks great. Could u please attach the master page and required files to download??? That would be great

  5. Oscar Says:

    Awesome article Tom!

    I am precisely working on a couple of things you point out in regards to the Ribbon.

    In my case, the SharePoint 2010 site will be public facing, it was decided that the Ribbon will not be shown (Alerts is at least one functionality that will not be shown). In order to accomplish this (not showing the Ribbon for anonymous users), we used the SPSecurityTrimmedControl to wrap all the Ribbon divs inside, specified the permision strings and that did it.

    I will be doing a blog post on this soon, and hopefully is not too late for Wes who seems to be interested in doing this.

    Keep up the great work!

    -Oscar

  6. Maarten Says:

    Wow, that looks great. Are you going to post a sample .master and .css?

  7. Yogi Bear Says:

    Fantastic post really interesting. I am trying to replicate something similar using your steps and each time I add the JQuery library to the master page SharePoint bums out .. Site Actions do not work etc… The ScriptResource.axd starts giving errors saying object form not found. Any Ideas?

  8. Yogi Bear Says:

    Problem solved .. it seems you can’t load the scripts with a self closing script tag I.E. ; it has to be … phew

  9. Yogi Bear Says:

    One last thing the hover states do not seem to work for the “ms-cui-ctl-large” have you noticed this?

  10. Adding a custom company menu tab with dynamic menu on the ribbon « Patrick's SharePoint Blog Says:

    [...] called ICC here that described a method of dynamic flyout anchors. Another post described here by Tom Wilson described how we could change the look and feel of the ribbon to fit the internal company [...]

  11. To Do or Not to Do, That is the Question: Styling the SharePoint 2010 Ribbon | EndUserSharePoint 2010 Says:

    [...] sent Marcy and me a note pointing to an article by Tom Wilson: “Guys just read Tom’s post on this . I think you should do something similar too to stand out from the [...]

  12. Daryl Barnes Says:

    Excellent Article… Sharepoint 2010 in the real world! Thanks.

  13. SharePoint Foundation Master Page CSS « Marc's SharePoint Notes and Findings Says:

    [...] post from Tom Wilson was also very helpful determining the elements that make up the new ribbon, Ribbon Customization: Changing Placement, Look and Behavior. The following is just a table of the CSS overrides that you may like to use to modify some of the [...]

  14. Akbar ali khan Says:

    Its really helpful, TOM could you please post the images used for the controls

  15. jim Says:

    Are you sure that making the ribbon fixed width that you are not losing options. For instance when i changed the width to fixed width -> when you go to a calendar and click on the events in the tab – > the tabs ribbon loaded….. what wasn’t obvious was that some tab options floated below the ribbon to start a second line. A user may not notice you were missing options if not fully familiar with the ribbon. The ribbon behavior of collapsing options when you resize your browser smaller doesn’t seem to work for me when I put fixed width on the ribbon.

  16. Jack Slator Says:

    When I use the ribbon within the relative position, ribbon is at the top floating, then the flyout menus do not work. Does everyone else have this problem?

  17. sladefx Says:

    great posting. I am trying to just expand the height of the SPRibbon in its default location.

    you mention *Note: This assumes that the ribbon has been placed in a custom div with the class of “ribbon-wrapper”.
    Do you have any resources you can point me too that shows I can create a custom div? or do you know of an easy way to expand the height? I have tried to drag the zone and do this via styles (body#s4-ribbonrow) but no luck

    thanks

  18. Tim Says:

    great article – but where does the jQuery code go?

  19. Branding your Sharepoint 2010 Site | Articles Review Says:

    [...] Pages http://technet.microsoft.com/hi-&#1110n/library/cc263203(en-&#965&#1109,personnel.14).aspx http://styledpoint.com/blog/ribbon-customization-changing-residency-look-&#1072n&#1281-behavior/ http://blog.drisgill.com/ http://www.nonlinearcreations.com/whitepaper/index.asp?id=17 [...]

  20. Dan gibbons Says:

    Great article on 2010 branding which I’m now tasked with, we’d like to move the ribbon and I’ve tried to follow your sample with the jquery code etc but it just turns to shit when I’ve finished!

    I put the “ribbon-wrapper” around the ribbon and this just seems to cause display issues i,.e. it becomes invisible.

    Just wondering if you could post a sample master?

    Thanks

    Dan

  21. Treasa Says:

    Hi, have you had any problems with this and IE 7?

  22. Anastasiosyal Says:

    Great article, very detailed! Just one thing seems to be missing though: ribbon-tab.png

  23. Sam Says:

    Hi! Can you please post the master page and css for this? It’s awesome!!!

  24. Andy Says:

    I just discovered something that might be of interest to someone – the Browse tab is not physically connected to what looks like the tab contents – if you comment out the entire .s4-title div then the ribbon actually collapses when you switch to Browse. I reckon the main nav and search box can also be moved out so they don’t get hidden when you change tab (but so far that causes a JS error for me).
    of course some of this will have to be displayed somewhere, but not necessarily within the “Browse” tab of the ribbon. Now to figure out how to rename ‘Browse’ to ‘Close’ or something

  25. Andy Says:

    Great article by the way!

  26. Updating the Ribbon « Emmett's SharePoint Blog Says:

    [...] stuck with the ribbon as is. I found a great blog showing how to update it. Check it out… http://styledpoint.com/blog/ribbon-customization-changing-placement-look-and-behavior/ Possibly related posts: (automatically generated)We are very much alive!Travel BlogTwitter is [...]

  27. Alan Says:

    Great writeup Tom! I’ve learned some good tips from this post. But, I noticed that the background of the Site Actions dropdown menu is also set to transparent by the tweak on s4-ribbonrow. How can I put it back just for the Site Actions menu?
    Thanks!

  28. Colin Says:

    Awesome, been trying to get a master page branded wihout using a custom master page, this gives me some great pointers!

  29. Zubair Says:

    Good work Tom … definitely the best looking sharepoint site i have seen :D

  30. milana Says:

    hi Tom
    is it posible to get masterpage example of this blog. It’s very very nice

  31. patrick Says:

    When i try to enter

    I get the error

    The ID ‘RibbonTabRowRight’ is already used by another control.

    Can anyone explain this to me?

  32. patrick Says:

    When I try to enter the code to change the location of the Ribbon i get the Error

    The ID ‘RibbonTabRowRight’ is already used by another control.

    anyone else get this?

  33. patrick Says:

    *Note: This assumes that the ribbon has been placed in a custom div with the class of “ribbon-wrapper”

    How do i place my ribbon in a custom div?

    sorry if this is super beginner im new to branding

  34. Charles Says:

    Hi. This is truly amazing. I have spent hours trying to get it to work and run into different problems.

    I know you are busy – please if I may ask just two questions:

    1. Is there any place, site, book I can get a copy of the master page and css used in your example. EVen if it could be just the master page so I can study it.

    2. Did you start off with a publishing site in 2010 or a minimal site using one of drisgall’s minimal start pages?

    Thanks for any help,
    Charles

  35. Kelle Giovanetti Says:

    Greetings I recently finished reading through your blog as well as I’m very impressed. I actually do have a couple queries for you personally however. You think you’re thinking about doing a follow-up publishing about this? Will you be going to keep bringing up-to-date as well?

  36. Terry Says:

    I’d love a copy of your master page and css if you are willing to send :)

  37. Dave James Says:

    Tom,
    Great Post but….
    Firstly as you have not replied to any comments I feel asking something maybe futile. As a blogger you must be prepared to read and follow up on the comments on your blog. It has left many of the questions posted in limbo.

    I have a similar design to yours, fixed width, banner at top and fixed ribbon. However I find when editing long pages the fixed ribbon is a pain. I removed s4-workspace from my master, basic rukle of fixed width sites. However this removes the floating behavior of the ribbon. In Edit mode, I want it to float at the top not scroll with my content out of visibility. Is this was your design does? How can I float it in dialog mode (edit) and retain the non scroll bar features of a fixed page?
    Thanks
    Dave

  38. Robert Bailey Says:

    Can anyone tell us where the class “.ms-cui-cg-db .ms-cui-cg-t” is actually being called from? I don’t see it in any of the Master pages so I am assuming it is from Javascript…

    Thanks in advance

  39. david Says:

    it was a great article but i didnt get i to work, there were a few issues witht is solution, can you put the code on a zip to see if i get the same issue. i had javascript issues.

  40. The SharePoint Muse » Blog Archive » SharePoint 2010 Branding and Customization Resources - SharePoint User Experience and Visual Design Says:

    [...] Ribbon Customization: Changing Placement, Look and Behavior – Tom Wilson, Styled Point [...]

  41. Trygve Says:

    Thanks for posting. I, like others, would love to see the demo and have a zip of the needed files. Can you explain how you handled the “Edit Webpart” property window that seems to open as a new column in a table within the workspace. I pushes my design beyond the 960px width. Thanks for any advice you can provide!

  42. Alain Says:

    Dear Tom,

    As I am a SharePoint beginer, I would be pleased to get the source of this great whitepaper too.

    Many thanks for that.

  43. Trygve Says:

    Does anyone have a working example of this modification? I have been trying to work with this on my intranet but I’m having several issues with the drop-down menus. For example, if I expand the Site Actions menu and then scroll the page the Site Actions drop-down menu repositions itself. I’d love to see a complete example if anyone has one. Thanks!

  44. Mor Shemesh Says:

    Wow, thats one amazing post, for you for all the info!

  45. Sean Panter Says:

    Hi Tom,

    Came across this while reading about hiding ribbon buttons. Great Post. Hope all is well.

    Cheers!

  46. Newbie Says:

    I’m a newbie, so I’m sure it’s me.. When I add the code to move the ribbon, I get an error that says it already exists. What am I doing wrong.

  47. Eric Says:

    This does not work for me. Maybe someone else has gotten lucky. Has anyone gotten this to work? Is the OP even active anymore? I am attempting this with Sharepoint 2010. sadface etc….

  48. Al Says:

    great post, do you have source code?

  49. Rohit Says:

    Hi,
    Please tell me how to add Tab in SharePoint 2010 using Share point designer

  50. Navi Says:

    Hi, Thanks for this article it is awesome. I am trying to create page like your, I need Publish site, team site and Mysite/My Profile in same layout with easy navigation. Could you please guide me how can i have same? As i can see in other comments every one want to haves you master page Please provide us the same. Thanks :)

  51. Max Says:

    Seems a very nice thing to do…But i could not get it to run properly. could you post or send the images and the code file for me.

  52. Pieto Says:

    Hi, I’ve just started with SharePoint 2010, Is there a eazy step by step way to brand a master page? like example: how to align the horizontal navigation bar centre and changing the color?

    regards

  53. Branding the Ribbon « Sladescross's Blog Says:

    [...] http://styledpoint.com/blog/ribbon-customization-changing-placement-look-and-behavior/ [...]

  54. Customizar Ribbon: Cambia el diseño, la ubicación y la usabilidad » .NET & MOSS Says:

    [...] está bastante bien explicado en este enlace, intentaré traducirlo [...]

  55. SharePoint Branding and Design – Tom Wilson » Blog Archive » Ribbon Customization: Changing Placement, Look and Behavior « Neptune Technology Solutions Says:

    [...] SharePoint Branding and Design – Tom Wilson » Blog Archive » Ribbon Customization: Changing Plac…. [...]

  56. SharePoint 2010 Ribbon Customization | Virtualize SharePoint and SharePoint Virtualization Says:

    [...] Nava 0 Comments SharePoint 2010 Ribbon Customization, Changing Placement, Look and Behaviour http://styledpoint.com/blog/ribbon-customization-changing-placement-look-and-behavior/ Share this:MoreLike this:LikeBe the first to like this post. SharePoint 2010 [...]

  57. Nilesh Rathod Says:

    [...] http://styledpoint.com/blog/ribbon-customization-changing-placement-look-and-behavior/ [...]

  58. Show Ribbon Permission based | Sharepoint Sriram Says:

    [...] http://styledpoint.com/blog/ribbon-customization-changing-placement-look-and-behavior/ Share this:TwitterFacebookLike this:LikeBe the first to like this [...]

  59. SharePoint 2010 Branding | Sharepoint Sriram Says:

    [...] Ribbon Customization: Changing Placement, Look and Behavior- Tom Wilson, Styled Point [...]

  60. jai Says:

    enna koduma sir eathu ;-(

  61. Matt Says:

    Dear God! Thank you so much for this!

  62. Suresh Lakum Says:

    How to apply custom format to your sharepoint site?

    I mean how to apply custom design to our site in sharepoint 2010 rather than default design?

  63. Tom Says:

    That’s a big question. I think maybe you need to start with a SharePoint branding 101 book. Just look on amazon for “sharepoint 2010″ and “branding”. Get the book by Randy Digswell.

  64. Kim Says:

    New to SharePoint and in the process of branding a new site. Where do I put the JQuery? And where do I put this // If there aren’t any buttons in the ribbon don’t display the box.
    hideRibbon = true;

    // The the Ribbon is loaded in the DOM
    $(“#RibbonContainer”).ready(function(){

    // Loop through the children of the ribbon icons. And if you find a child, set the flag to false.
    $(“#s4-ribboncont .ms-cui-tts li”).each(function(){
    hideRibbon = false
    });

    //If the flag was never triggered (no icons were found) then hide the ribbon box.
    if(hideRibbon)
    {
    $(“#s4-ribbonrow”).hide();
    }
    });

  65. Expert SharePoint Developers Blog Says:

    I like your Post very much and It is very interesting. I will use this Info to Develop the SharePoint Applications. Thanks for share this valuable Information.

  66. Ribbon Customization: Changing Placement, Look and Behavior | Sharepoint Says:

    [...] anyone want chage the ribbon UI then go through this link link Share this:TwitterFacebookLike this:LikeBe the first to like this post. By vchilukuri [...]

  67. Ruud Dam Says:

    Love the post! Trying to brand the schools Intranet and can’t get it to work because I am a SharePoint Noob. Any chance of the required files?

  68. Tom Says:

    I have something in the pipe for people like you in the near future.

  69. Ruud Dam Says:

    That would be awesome!

  70. Kristopher Says:

    I am attempting to use this on a 2013 site, but I am not sure if it works for that, do you know?

  71. Tom Says:

    It actually isn’t written for 2013 and I doubt it will work there.
    Sorry!
    If I had time I would write a new article for 2013.

Leave a Reply

Whitepaper RSS Feed