Friday, May 8, 2009

SharePoint Add Custom styles to Rich Text Editor or Content Editor Web Part

To get available the custom styles (css classess) in content editor web part-Rich Text Editor, the custom style (css class) name in css file should be preceded with ‘.ms-rteCustom-‘. So the final class name will look like .ms-rteCustom-ClassName

Add the below css class in your css file (which is used for your site) and save it.
.ms-rteCustom-TestClass
{
Font-size:12pt;
}


Go to content editor web part tool pane and open Rich Text Editor. Now the above added class will be available under the styles tab on editor.

Add the text in the editor --> select the content --> go to styles tab --> select the TestClass class.

The TestClass style will be applied for the selected content.