The Content Editor Web Part (CEWP) allows you to add text, html, scripts or styles to a SharePoint page. Its versatility makes it a favorite among Web designers.
The fpweb.net site offers a tutorial on how to add a CEWP to a page:
The CEWP has two edit options:
– Rich Text Editor: as it says, allows you to add formatted text.
– Source Editor: this is a more powerful option, allowing you to add html, scripts or styles.
Note that the CEWP is not the only Web Part to allow you to add html to your pages. In some cases you may also consider the Form Web Part or the Page Viewer Web Part.
Looking for examples?
You’ll find on the Web many examples of how to use the CEWP. There’s even a whole site dedicated to it:
If you add scripts or styles, you’ll usually choose to hide the CEWP (check the “Hidden” box under Layout).
If you break your Web page…
When playing with the CEWP, you run the risk of adding bad code that will break your page. SharePoint will then throw out an error message, without offering any way to undo your changes.
If this happens to you, here is a useful trick: append the “?contents=1” querystring to your URL. It will give you access to the maintenance page, where you’ll be able to get rid of the faulty Web part.
For example, if you inadvertently break this page:
A trick to edit Web Part pages
On some pages, the edit option is not available or is grayed out. This is for example the case for the edit form of a list.
The workaround here is to append the “?ToolPaneView=2” querystring to your URL, which will switch your page to edit mode. Note that it seems to be unsupported by Microsoft, though I haven’t read an official confirmation.
For example, if you want to edit: