Thursday, February 20, 2014

Updating SharePoint Ribbon Styles and Markup Styles

The SharePoint 2010 Ribbon contains default styles and elements in their Styles and Markup Styles sections. Using CSS, you can add styles or elements as well as hide OOTB styles and elements.

To create new items, use the ms-rteElement or ms-rteStyle prefixes in your CSS file.

H2.ms-rteElement-H2Custom
{
     -ms-name:Title;
     color:#008C99;
     background-color:transparent;
 }

.ms-rteStyle-Normal
{
      -ms-name:"Normal";
      font-size:10pt;
      font-weight:normal;
      background-color:transparent;
}

To remove the Styles button entirely:

#Ribbon\.EditingTools\.CPEditTab\.Styles
{
      display:none;
}

To remove a single element from the Markup Styles list (Change the ElementWithStyle index number to hide the element based on its order in the list.):

li.ms-cui-menusection-items a#ElementWithStyle0-Menu
{
      display:none;
}
li.ms-cui-menusection-items a#ElementWithStyle1-Menu
{
      display:none;
}