Thursday, 6 March 2008

Add custom Styles to Rich Text Editor Sharepoint - content editor web part

To add custom styles to the Rich Text Editor in SharePoint (both the ones accessed through the content editor web part and the inbuilt page content web part), just add styles in the format ms-.ms-rteCustom-nameofclass to your css style sheet that your master page uses. It's as simple as that.

If you are not using custom master pages style sheets, then just add the styles in the format rteCustom-Title (rteCustom- should appear before the style name) to a stylesheet and upload the stylesheet css file to the style library of the site collection, then go to site settings - master page settings and choose the override style sheet option and point to the style sheet that you just uploaded to. That's it, now when you open the rich text editor in sharepoint, type in some text, highlight the text you typed and from the styles dropdown choose the style you want.

Example of custom style that would appear in the css class .ms-rteCustom-TitleRed{Font-family: arial;Font-size: 14pt;Color: Red;}

7 comments:

Antonio Lettieri said...

are there any additional steps that need to take place in order for this work? I have imported several classes into my custom stylesheet. When using the Rich Text Editor, none of my classes are available. Thanks in advance... Antonio

Suprej Venkat said...

Are you using a custom css class attached to your master page? If so can you please send me an example of the class that you are using?

Chris Arella said...

I tried this technique by copying the example you gave and putting it into an overriding CSS file in MOSS and couldn't get it to work. The CSS was initially linked in the head of the custom master page which didn't work. Then I tried selecting the CSS as the overriding CSS on the master page settings and that didn't work either. I then tried creating my own custom class with no luck. All of the other CSS I use to override the OTB MOSS styles works fine so I can only assume this technique doesn't work. Any clarification would be greatly appreciated.

Chris Arella said...

Never mind, it was a caching issue. It's working now. Thanks.

Suprej Venkat said...

Sorry just seeing your message. Yes should have mentioned there are quite a few occasions where caching place a part in MOSS.

Anonymous said...

Hello,
I have an issue here - the custom styles are visible only to one user, even if there are other users (=admins). What is wrong?
Thanks!

Suprej Venkat said...

Sure Thomas, please carry on.