Custom Styles for SharePoint 2010 Rich Html Field

October 27 2010 100 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% [?]

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

  1. Marcy Kellar says:

    You guys are killing me with the comic sans!!

    But great blog post! kudos!

  2. Brad says:

    Comic Sans – That’s the only font I’ll use from now on. You guys rock!

    Once I realised that this is great for “Everything but IE” I had a quick hunt around and found this – – works alongside the -WebKit and -moz functionality and kicks the goals I want. Useful for people developing solutions for clients with an IE install-base.


  3. Daisy says:

    Great article~! But how can we open up the page layout containing the HTML editor at the first place?

  4. Han says:

    This is great, I got this working as described for the Rich Html Field in a page layout, but how do we show the custom styles for the Content Editor (Rich Text) web part when inserted by the author?

  5. Shawn Z says:

    Custom HTML Tags in SharePoint
    To add custom HTML tags such as meta description, keywords, and titles, you will want to edit the page in SharePoint Designer. We first need to start be verifying the existing page and template are in good form and readable by SharePoint. Skipping this step can lead to erroneous error.
    1) Open SharePoint Designer
    2) Edit in Advanced Mode
    3) Goto Design View — This will test the pages and all problems denoted need corrected.
    4) Go to code view and add the custom Title in “asp:Content “ named “PlaceHolderPageTitle”. This should be the TITLE Content /TITLE, omit the title tags.
    5) META Description goes in the “asp:Content” named “PlaceHolderAdditionalPageHead”. This will be the actual HTML code.
    When I followed the directions provided by others, I had a small problem in the ASP which provided an accurate error by following steps 1-3.

    Shawn Zernik
    Internetwork Consulting

  6. Shawn Z says:

    To add custom HTML tags such as meta description, keywords, and titles, you will want to edit the page in SharePoint Designer. We first need to start be verifying the existing page and template are in good form and readable by SharePoint. Skipping this step can lead to erroneous error.
    1) Open SharePoint Designer
    2) Edit in Advanced Mode
    3) Goto Design View — This will test the pages and all problems denoted need corrected.
    4) Go to code view and add the custom Title in “asp:Content “ named “PlaceHolderPageTitle”. This should be the Content, omit the title tags.
    5) META Description goes in the “asp:Content” named “PlaceHolderAdditionalPageHead”. This will be the actual HTML code.
    When I followed the directions provided by others, I had a small problem in the ASP which provided an accurate error by following steps 1-3.

  7. Tom K. says:

    Thank you for this post!

  8. Hmmm says:

    How about the Position dropdown (Fin: “Sijainti”) for an image: which styles belong under that? I made a test and I got the button blank now. Image *Styles* I got back by finding and adding appropriate styles from the original htmleditstyle file. But I thought the original ms-rte-Position-1, -2, and so on would be about the Position button. I renamed them according my new file, but the button stays empty.

  9. Hmmm says:

    This was solved by me, and it was about naming and alternative css…

  10. Bo Huge says:

    I’ve looked up the table styles in the above mentioned css file. And have tried to define my own set og styles. Which works like a charm. But for some reason, I cannot get the table styles to show in the table style menu. My prefix is added and the styles I have added are there, but I cannot select among them in the menu. Any ideas?

  11. Cutty says:

    Thank you, thank you, thankyou. Have been trying to get my custom styles in the drop down for weeks and this is the only article that mentions that the css style needs to have “Style” appended to the custom style prefix in order for it to appear in the list.

    Something so simple, yet Microsoft make it so frustrating…grrrr.

  12. Yeah its a lil’ off topic lol you spotted a couple of typos about halfway thr

  13. Soni says:

    Anyone know how to let the content author remove a style/markup.

    I can get the styles/markup into the dropdowns, but i can’t remove the inserted class, without going into the html-Edit html source dialog.

  14. Soni says:

    Never mind, finally figured out that selecting my custom style with the Select Command and then using Clear Format will remove my style. Apparently i never got the style selected properly :(

  15. Victor says:

    I am developing website with a customized masterpage.
    Anyone knows how I can set PrefixStyleSheet property for RichHtmlField

    As I did not use a pagelayout for the site.


  16. Thierry says:

    I need to change default font size for the wiki pages of the site I am community manager in my (large) company. Verdana 8pts is definitly unreadable ! Does this post permit to do it for my site only or will other sites be impacted as well ? My IT department told me that it is impossible to change default font for my site without changing it for others. What do you think ?

  17. Tuukka Uskali says:

    Thierry, you could change the font by using an alternative css for that site(with publishing features enabled) or just add a few wiki-page specific common css rules for your default css. Use your browser of choice and fire up developer tools to look for common elements only visible on the wiki pages and override their default styles on your own custom stylesheet.

    With enterprise wiki it usually goes like:

    .col-fluid-1 p { font-size: 1.1em !important; } or .edit-mode-border { … }

    ..or you could use the adjacent sibling selector:

    .ewiki-margin+div { font-size: 14px; }
  18. This piece of writing is really a good one it assists
    new the web viewers, who are wishing in favor of blogging.

  19. clear says:

    This article will help the internet visitors for
    creating new website or even a blog from start to end.

  20. Issac Hsueh says:

    Needed to send you this tiny observation so as to say thank you as before just for the precious concepts you’ve contributed on this website. This is so shockingly generous of you giving unreservedly exactly what numerous people would’ve offered for sale as an e-book to help make some profit for their own end, and in particular now that you could possibly have tried it in the event you desired. The strategies in addition served to become a great way to be sure that most people have the same interest really like my personal own to learn significantly more on the subject of this issue. I’m certain there are lots of more pleasant opportunities ahead for folks who view your website.

  21. Ofer Gal says:

    I have this working for my customer but now he wants one of the styles to be the last in the drop-down.
    In the special CSS file, I have it as the last entry but SharePoint Does not care.

    Anyone know how to force an order?

  22. Nha Trang says:

    Thank you so much a bunch with regard to giving that with all of persons you truly determine what you happen to be discussing! Bookmarked. I implore you to moreover seek advice from this site Is equal to). Organic meat have a link transform set up involving us all

  23. Krutika says:

    I am trying to achieve same functionality for Wiki page library.
    I have modified EnterpriseWiki.aspx in sharepoint designer and have added the PrefixStyleSheet=”my-rte” in the same.

    My CustomStyle.css file is stored in the StyleLibrary.

    I have added class as mentioned above for hte rounded paragraph in my css.
    When opening page in edit mode from wiki page library. It still shows the preexisting styles. and doesnt show up the style as described above.

    Am I doing something wrong ? Please help!


  24. In addition they have a wide range of parts you can purchase.
    CORPORATE PROFILE: Since 1989: Restoration Environmental, one
    of Canada’s leading GREEN specialty contractors in Asbestos Removal, Demolition and Disaster Recovery,.
    The four latest artworks include ‘The Trunk’, ‘Franklin and Chop’, ‘Stop and Frisk’ and ‘Vinewood’.

  25. Striped candies and the color bombs are your friends here.

    The second best combination is to mix a wrapped candy with a striped candy,
    so that you can clear entire rows and columns when detonated.
    Then may take some practice, but it is definitely worth the effort.

  26. Again, just make sure you input the required information – your name on Facebook and a link to the tweet, respectively – so we
    can verify your entries are valid. Next question is probably where do you store that piece of paper
    or file. Security hacks have occurred at Microsoft,
    Google, Microsoft and Amazon.

  27. While other sites place a heavy emphasis on social connections or participating within the
    development of new objects, Blue Mars offers plenty of
    tools to serious gamers that want to develop new video games.
    Social video games are moreover extremely popular on this website.
    If possible try some more and let your head touch your knees, again without bending your knees.

  28. Simply put, the ASUS F1A75-V Pro is an excellent motherboard that
    offers plenty of connections, customization options, with an simple to use interface
    with solid performance in a price that will not break the bank.
    In the benchmark called 3Dmark 2006, the Gigabyte H55M-USB3 performed having a score of 9627, an ECS
    H55H-M were built with a score of 9656, an ASUS P7H55D-M EVO
    had a score of 9952, with an Intel DH55TC a score of 9132.
    The benchmarks used were Crysis (FPS), Far Cry 2 (FPS), STALKER Clear Sky (FPS),
    Battle – Forge (FPS), 3DMark Vantage Performance (Score),
    3DMark Vantage Extreme (Score), Idle System Power (Watts), and
    Full Load System Power (Watts).

    My homepage whatsapp on pc

  29. Hello, I think your site might be having browser compatibility issues.

    When I look at your website in Ie, it looks fine but when opening in Internet Explorer, it has some overlapping.
    I just wanted to give you a quick heads up! Other then that, terrific

  30. Although it was not noted in the publication of the lawsuit, particular types of decelerations may
    be a sign of fetal distress. A night nurse provides evening or overnight care services for
    newborns and occasionally seniors at your home.
    According to Florida law, for every 20 children the facility is licensed for,
    there must be at least 1 staff trained in CPR and 1st Aid.

  31. Thanks for finally writing about > Custom Styleds for
    SharePoint 2010 Rich Html Field | SharePoint Blues < Loved it!

  32. Geraldo says:

    ve been searching all around and the truth
    was in my eyes the whole time. This is another
    way to increase the level of intensity within the game,
    now that you can have at most sixteen players playing side by side or competing against
    one another. Word games have become increasingly popular
    over the past few years especially since they can now be played at ones convenience.

  33. Nice post. I learn something totally new and challenging on sites I stumbleupon everyday.
    It’s always useful to read through content from other writers and
    use something from their web sites.

  34. football says:

    He’s not desperately trying to look like a big shot. It
    is Tennessee’s Rocky Top, Florida’s Old Ball Coach, and
    of course the Gator Chomp and the mighty Tim Tebow.
    Fan evaluations of the seat ranges will give you a great idea if the tickets you are bearing in mind
    are worth what you will splurge.

  35. Good article! We will be linking to this great post on our website.
    Keep up the great writing.

  36. I like the helpful info you provide in your articles.
    I will bookmark your weblog and check again here regularly.
    I am quite sure I’ll learn plenty of new stuff right here!
    Best of luck for the next!

    Feel free to surf to my site :: descargar whatsapp para pc

  37. With havin so much written content do you ever run into any problems of plagorism or copyright violation? My
    site has a lot of exclusive content I’ve either written myself or outsourced but it seems
    a lot of it is popping it up all over the internet
    without my authorization. Do you know any techniques to
    help prevent content from being ripped off? I’d definitely appreciate it.

    my blog post ucsd email outlook

  38. freecams says:

    I think the admin of this site is actually working hard in support of his web site, for the reason that here
    every information is quality based material.

  39. teen cams says:

    I am really enjoying the theme/design of your
    blog. Do you ever run into any web browser compatibility problems?
    A number of my blog visitors have complained about my website
    not operating correctly in Explorer but looks great in Firefox.

    Do you have any advice to help fix this problem?

  40. ragazze cam says:

    I read this piece of writing fully regarding the difference of most recent and earlier technologies, it’s
    remarkable article.

  41. hello there and thank you for your info – I’ve certainly picked up anything new from right here.
    I did however expertise a few technical points using this website, since I experienced
    to reload the site a lot of times previous
    to I could get it to load properly. I had been wondering if your web host
    is OK? Not that I’m complaining, but slow loading instances times will often affect your placement in google and could
    damage your high quality score if advertising and marketing with Adwords.
    Well I am adding this RSS to my e-mail and could look
    out for a lot more of your respective intriguing content.
    Ensure that you update this again soon.

  42. Santos says:

    What’s Taking place i’m new to this, I stumbled upon this I have found It
    absolutely useful and it has aided me out loads.
    I am hoping to contribute & help other users like its aided me.
    Great job.

    Feel free to surf to my blog; internet (Santos)

  43. Anthony says:

    Nice answer back in return of thbis difficulty with genuine arguments
    and telling everything on the topic of that.

  44. naturally like your web site but you have to test the spelling on several of your posts.
    A number of them are rife with spelling issues and I find it very bothersome to tell the reality nevertheless I will definitely come again again.

  45. Shenna says:

    They feature because there are many delivers where you receive
    very much chances for gaining far more amount of IMVU credits for not wasting money onto
    it. It really is a lot convenient to use the IMVU credits you make in PrizeRebel.
    You must have a free account with this website
    and you can now receive IMVU credits for the actions you do
    so when you reach the amount of issues you could
    redeem, you can redeem it through winning prize part.

    You need to then log into IMVU and easy access
    the webpage for pre-paid cards just where you should
    go into the greeting card computer code to help
    you make use of the credits you earned in IMVU.

  46. What’s up to every one, the contents existing at this web site are truly remarkable for people knowledge, well, keep up the good
    work fellows.

  47. They are basically an audio file (mp3) plus a graphics file that you play at the same time.
    Step 3: Rehearse timings of your karaoke Power –
    Point. All you need to do is load and click, and you can play for hours at
    a time and enjoy an entire night of fun and laughter.

  48. The very first thing you should do to repair the
    crack is remove the damaged a part of the concrete. If not caught in time, hairline cracks
    grow and increase turning into alligator cracking. ) One disadvantage
    of drilled rotors is that they will provide more friction against
    your pads and reduce the life of them.

  49. This article will be discussing one of the best games for game consoles of this company.
    A new Themes mode includes drawing, photography and voice acting challenges, letting you share your creativity with friends and family.

    This game is largely responsible for the success of the NES, and, on a larger scale, the
    revival of the video game industry after the video game crash of 1983.

  50. fantastic put up, very informative. I ponder why the opposite experts of this sector do not realize this.
    You mustt continue your writing. I’m sure, you’ve a huge readers’ base already!

    Look aat my homepage; lazy thin Formula pdf

Leave a Reply