Take the 2-minute tour ×
SharePoint Stack Exchange is a question and answer site for SharePoint enthusiasts. It's 100% free, no registration required.

A pretty rudimentary question this time...

When I edit a SharePoint page and add HTML or CSS either directly, or in a Content Editor web part, why does SharePoint often seem to change the resulting code, such that it breaks. And when you go and re-edit it it looks different.

And how do I stop this happening?

Thanks.

share|improve this question

1 Answer 1

up vote 0 down vote accepted

SharePoint contains a white list of allowed tags and attributes and with every change of the HTML it ensures that all of markup complies with the white list. Depending on what the SharePoint version is that you're referring to it could be as well that it has to do with the MSHTML implementation that SharePoint uses and which has been built for parsing speed but not standards compliance. So depending on how the markup is modified, it could be either related to the white list or the MSHTML implementation or just with how the Rich Text Editor is built. Unfortunately there is no way of disabling it.

share|improve this answer
    
Thanks. Will it allow things that aren't in the whitelist if they are stored in a .htm file as a site asset, and then puled in via a Content Editor web part? –  finisterre Feb 24 '13 at 17:39
    
Yes, that should work. It's only the content of the Publishing HTML Field and the Content Editor Web Part that is being modified. –  Waldek Mastykarz Feb 25 '13 at 16:20

Your Answer

 
discard

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.