# The .html.bit library: rich HTML in SharePoint 2010

> A quick and dirty trick for injecting HTML, CSS and JS into SharePoint 2010 pages with .html.bit files and a Content Editor Web Part. You should not do this.

Source: https://ali.id.au/blog/the-html-bit-library/ (last edited 2026-10-16)

<!-- markdownlint-disable -->
Just an extremely quick and dirty trick I’ve used for a while now I thought I’d note down somewhere. It’s horribly inelegant and almost definitely very very wrong. You should definitely not do this.

In the ‘Site Assets’ library of a site, create an ‘htmlbits’ folder. In this folder, create a file with the format myFunction.html.bit. (The .bit extension stops various bits of SP machinery, such as SP Timer Jobs, from messing with your HTML)

Then, use these snippets on a page with a Content Editor Webpart. Simply set the title of a Content Editor Webpart to the name of the HTML bit, set the Content Link to the .html.bit’s path, and set the title not to display. Your .html.bit file will be injected into the page, and SharePoint will not mess with your code!

This seems to bypass SharePoint’s HTML filtering, and it’s handy for debugging. A sort of nicely self-documenting and simple way for a designer simply trying to inject some HTML, CSS, and JS into a page. The deployment workflow is simple. Save and refresh.

I should also point out that it is potentially going to be frowned on by the security gurus at MS, who may see it as a bug. Dunno, not a security expert.

Anyway, once you have reached a solution using this trick, you should consider whether you can generalize what you’re doing into the master page, or the page layout, or deploy a custom solution using Visual Studio that can do this in a neater way. Don’t forget to delete the htmlbits folder when you’re done.

**Update:**

Forgot to note that Waldek Mastykarz [has a different method](https://web.archive.org/web/20141010231415/http://blog.mastykarz.nl/publishing-rich-html-no-limitations-sharepoint-2010/) which some may find more appropriate for their needs.

