Custom Styles for SharePoint 2010 Rich Html Field

October 27 2010 179 comments

A typical requirement from a client is to be able to incorporate their own custom styles for the Rich Html Field. Allowing their public relations department to apply nice text formating for paragraphs with some Comic Sans Hotness might not be the best practice in here, so let’s be careful out there. The best scenario is only to allow custom formatting for headings, paragraphs and maybe a few different table styles but let’s go!

First, open up the page layout containing the HTML editor and add PrefixStyleSheet property for the RichHtmlField:


Now, the default value for the property is ms-rte. We are going to redefine this to my-rte. Do not use any uppercase characters in the property value as apparently those wont work. Deploy the page and open it in edit mode to see the desired effect. The styles collections are now empty in the Ribbon.

We now have to define our own styles prefixed with the string my-rte. I’d suggest that you put these style declarations in a separate stylesheet to avoid javascript errors caused by complicated and hard-to-parse stylesheets. Let’s name our new stylesheet rte.css and add a few declarations there.

The Markup Collection

Let’s say I want to have an option to add a level 1 heading or an H1 tag for the given page via the Markup Styles dropdown list:

Step 1 – introduce the tag:
  -ms-name:"my level 1 heading";

Step 2 – add the styles to the tag:

    font-size: 150%;

Save the rte.css and make a reference for it in your master page, page layout or even use an alernative css. If you want your clients to be able to edit the styles themself, you could upload the rte.css in the Style Library and reference it there.

I have saved the file directly in the 14-hive /_layouts/my/ -folder and use a quick reference in the master page:


Deploy and reload the page, fire up the edit mode and navigate to the ribbon where you can see your new style in action.

Your first custom style

Adding new elements is easy once you get to know the logic. Here’s an example of a parapgraph with nice rounded corners and superb font on modern browsers (note that I have combined the introduction and style values in one declaration):
    -ms-name:"My CSS Rounded Paragraph";
    background: #808;
    color: #fff;
    border: 3px solid #f0f;
    text-transform: uppercase;
    text-align: center;
    -webkit-border-radius: 10px;
    -moz-border-radius: 10px;
    border-radius: 10px;
    box-shadow: 0 0 20px #000;
    -moz-box-shadow: 0 0 20px #000;  
    -webkit-box-shadow: 0 0 20px #000;
    padding: 10px;
    font: bold 2em Comic Sans MS;

Even Grammatical Errors Wont Silence the Comic of Sans

The Styles Collection

The Styles collection can be populated with the same way by changing the Element-suffix into Style ie.:

  -ms-name:"I am pink";
  color: #f0f;

This (P)arapgraph is Pink

Other Items

I’d suggest that you check out the default HTML editor styles in /Style Library/en-us/Themable/Core Styles/htmleditorstyles for quick reference how to style the other elements, including table styles on the Ribbon.

Popularity: 14% [?]

179 comments to “Custom Styles for SharePoint 2010 Rich Html Field”

  1. Cassandra D. Everhart says:

    Nice post. I learn something more challenging on your different blogs everyday. Thanks for sharing. our site

  2. Dan says:

    These codes are very helpful. Thanks by the way! :)

  3. alex friar says:

    The beauty of the African sunset disguised the danger lurking nearby. concrete repair

  4. Allie Frayer says:

    The irony of the situation wasn’t lost on anyone in the

  5. Big Niga, Big Racks! says:

    Garlic ice-cream was her favorite click here!

  6. John says:

    Awesome stuff – don’t forget to visit us!

  7. Grant says:

    This is great to learn more about when learning about ccs. Concrete Repair

  8. Joe says:

    We test out this font on our Asphalt Repair site to help attract more customers with the known font.

  9. Jorge says:

    CCS is probably the most black box area of website design for beginners. This helped break it down into a way that was easy to understand. I will definitely be referring back to this page. Thank you!

    Visit Us

  10. Burt Macklin says:

    This was super helpful and very easy to follow. Thank you for sharing this with us.
    -Burt | Overland Park Auto Glass Replacement

  11. Thanks for the easy explanation of CSS. A bit of the paygrade of myself at my concrete driveway company, but interested nonetheless!

  12. Tony Wilder says:

    Great look into custom headers. Our humble chimney sweep Melbourne company does not use sharepoint currently, but are working towards being fully operational through Teams

  13. Greg Norman says:

    This absolutely perplexes me still!

  14. Concrete says:

    Fair credit to you for getting through this

  15. AndrewB3 says:

    Love this, thanks for explaining…. we do roof replacement if anyone is interested!

  16. Spend some extratime with the best shemales on the whole web only at Shemale Adelaide! Visit today for free sexy chat!

  17. Megan says:

    If you’re interested in some expert teeth cleaning services, feel free to visit our site:

  18. If you are lonely and looking for sexy female company for free conversations in the long nights you must try to visit Submissive Sex and I’m sure you will not regret it

  19. Denver Tile says:

    Thank you for sharing!~

  20. Interesting! Thank you for sharing!

  21. ao kontakt says:

    Spend some extratime and chat for free with hot sexy ladies on ao kontakt! Visit right now for your own pleasure!

  22. aussie milfs says:

    aussie milfs is web platform where’s local ladies waiting for chat with you

  23. Very good and hot girls for the chat is waiting for you if you visit tranny hobart

  24. Katara says:

    Thank you so much for sharing this article.Well done! Towing Grand Junction

  25. Lin says:

    Thank you so much for sharing this article.Well done! Concrete Contractors Colorado Springs

  26. Yu says:

    Great information it’s very helpful! Roofing Companies Aurora

  27. Xin says:

    I like your articles, Awesome work! Roofing Companies Fort Collins

  28. Rick says:

    Nice article! Very informative Thank you! Roofing Companies Parker

  29. Esmeralda says:

    This is a great articleRoofers Boulder

  30. Minato says:

    I love your article! Firewood Boulder

  31. sex geelong says:

    Visit our web platform and enjoy free chat with fine local ladies all night long – sex geelong

  32. SEO says:

    continue the good work!

  33. This is awesome. Valuable and great information. Thank you for sharing.

  34. oma sex dresden – for your own sexy chat pleasure

  35. You gave us a very detailed instructions on how to use this Custom Styles for SharePoint 2010 Rich Html Field. After i clean my fireplace, I’ll try these codes and see how they work. Thanks!

  36. Great stuff. I would implement this tips to our tasks .Click Here to view our website projects.

  37. slags glasgow is the best web place for chat contacts with hot girls in UK

  38. The power washing companies near me are looking for new employees tips. Great that we found this rich html field topic

  39. If you are ready for hot chat with local ladies in UK check this platform sluts edinburgh

  40. This is something I can agree with. Good job on your part there!

  41. For casual conversation with fine shemales in UK you must to visit trannies in birmingham

  42. You need to try our web platform for casual chat experience in UK Shemale Brighton

  43. Alonzo says:

    Thanks for this article. Regards Concrete Company in Elk Grove, Ca

  44. Yna says:

    I really appreciate you sharing this information. Cheers from us Concrete Company in Vacaville, Ca

Leave a Reply