SharePoint Stack Exchange is a question and answer site for SharePoint enthusiasts. Join them; it only takes a minute:

Sign up
Here's how it works:
  1. Anybody can ask a question
  2. Anybody can answer
  3. The best answers are voted up and rise to the top

I have a RichHtmlField in one of my page layouts. Editing, Previewing and publishing are all working fine. The problem I have is with the code that is being output from the contents of that RichHtmlField.

I entered 'this is something' and made it a heading 1. Then I wrote 'what is this?' and made it a paragraph. and this is the code it spit out ...

<div id="ctl00_PlaceHolderMain_PublishingPageContent_label" style="display:none">Page Content</div>
<div id="ctl00_PlaceHolderMain_PublishingPageContent__ControlWrapper_RichHtmlField" class="ms-rtestate-field" style="display:inline" aria-labelledby="ctl00_PlaceHolderMain_PublishingPageContent_label">
<h1 class="ms-rteElement-H1">This is something</h1>
<p class="ms-rteElement-P">What is this?</p>
<p class="ms-rteElement-P"></p></div> 

Shouldn't this be ...

<h1>This is something</h1>
<p>What is this?</p>

Thanks for all of the help. It seems when ever I get one questioned answered, I get another 10 questions. Hopefully one day I will be the designer who helps more than he asks :)

share|improve this question
up vote 1 down vote accepted

Unfortunately that's how the rich text editor works. You cannot accurately predict what type of HTML is created by the out-of-the-box rich text editor. If you can write all the content using HTML (or at least manually clean up content), you should do that instead. But if you have many authors who don't know HTML, there are several options:

  • Write CSS specific to rich text editor content in a way that hides bad mark up (e.g. don't use collapsing margins), and create custom Styles or Markup Styles for everything
  • Write a script to clean up the code before an author saves, or before a user sees the content (e.g. remove empty tags, remove span's or div's that have no IDs/classes)
  • Use a third party rich text editor tool that has SharePoint integration
share|improve this answer
Thanks buddy ... not really the answer I was hoping for. Seems like such a powerful product would have better HTML rendering ... but, that's the way the ball bounces! – mdumka Nov 10 '12 at 4:30

Your Answer


By posting your answer, you agree to the privacy policy and terms of service.

Not the answer you're looking for? Browse other questions tagged or ask your own question.