HTML Filters and Inline Styling in CKEditor for Drupal 7 (Open Source Version)

This website contains links to software which is either no longer maintained or will be supported only until the end of 2019 (CKFinder 2). For the latest documentation about current CKSource projects, including software like CKEditor 4/CKEditor 5, CKFinder 3, Cloud Services, Letters, Accessibility Checker, please visit the new documentation website.

If you look for an information about very old versions of CKEditor, FCKeditor and CKFinder check also the CKEditor forum, which was closed in 2015. If not, please head to StackOverflow for support.

In the Administration panel > Configuration > Content Authoring > Text formats section Filtered HTML is the default filter. Due to security reasons enabling Full HTML is only an option for trusted users.

To take full advantage of using CKEditor you can extend the list of allowed tags in the HTML filter that is enabled in the Filtered HTML input format. If you do not do this, you may notice that a page created in CKEditor looks different after saving.

Unfortunately, even if you extend the list of allowed tags, one problem still remains: Filtered HTML not only strips disallowed tags, but also strips inline style definitions. It basically means that you are unable to apply a different font color, size or family, align images etc. using CKEditor out of the box.

You can solve this problem by creating another input format that will work in a similar way as Filtered HTML (will only allow specified tags), but in a much better way — i.e. it will not strip inline styles that CKEditor is using when formatting text or images after the page is saved. To create such an input format, you will need an HTML filter. The list below presents three modules that provide HTML filters:

It is up to you to decide which one to use. Just make sure that you will only allow to use proper inline styles, tags, and attributes.

This page was last edited on 30 May 2012, at 15:24.