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;}

10 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.

byodbuzz04 said...
This comment has been removed by the author.
byodbuzz04 said...

A Plain Text Editor
Plain Text files
That's right, if you're writer on a budget, you don't need to spend any money buying expensive writing software or apps. Instead, you can use the text editor that comes free with your operating system.
Just open up Notepad on Windows or TextEdit on a Mac. I like plain text editors for writing something short quickly and easily, without thinking much about it. I wrote a blog post about the benefits of using plain text editors as writing software.
Use for: writing whatever, wherever

byodbuzz04 said...

A Plain Text Editor
Plain Text files
That's right, if you're writer on a budget, you don't need to spend any money buying expensive writing software or apps. Instead, you can use the text editor that comes free with your operating system.
Just open up Notepad on Windows or TextEdit on a Mac. I like plain text editors for writing something short quickly and easily, without thinking much about it. I wrote a blog post about the benefits of using plain text editors as writing software.
Use for: writing whatever, wherever