I was trying use span and style tags in pages, rather than in CSS and it seems that Drupal is configured to strip them out whether the input format is Filtered HTML, i.e. they are applied to Full HTML.

Is that something which can be fixed only by editing the core files, or are the some modules or settings in Drupal's admin settings that can override that?

  • 1
    And whatever you do, never change Drupal core files! Commented Feb 7, 2015 at 8:55

4 Answers 4


Go to Configuration -> Content Authoring -> Text formats. Here you can configure what tags are allowed.

All unallowed tags are stripped out, is always stripped out.

Check out https://www.drupal.org/project/wysiwyg_filter for more advanced filtering.

  • if you dont want to limit filter. In Configuration -> Content Authoring -> Text formats -> configure Filter HTML "enable filter" -> uncheck "Limit allowed HTML tags" will allow what ever tags you want in the editor Commented Feb 7, 2015 at 8:18
  • @DEVARAJJOHNSON The Limit Allowed HTML Tags appears to strip out some tags like span and style
    – vfclists
    Commented Feb 7, 2015 at 16:01
  • I do not use any input filters.
    – vfclists
    Commented Jun 17, 2017 at 10:30

Are you using a WYSIWYG module like "CKEditor - WYSIWYG HTML"?

It appears to be this module or the CKEditor itself that is wrongly stripping out correct HTML such as inline styles, not Drupal.

There is a bug report open here https://www.drupal.org/node/778200

My current workaround is to disable the editor when adding these types of HTML so that I edit and save while in source mode.

You could also try using a different WYSIWIG editor besides CKEditor. This module allows several different editors to be used: https://www.drupal.org/project/wysiwyg

  • I am not using any editors and none of the markup I enter is stripped out
    – vfclists
    Commented Jun 17, 2017 at 10:29

As authtentictech noted above, disabling the editor can work (I create a text format of Full HTML-No Editor) to deal with the edge cases where this can pop up. Here, it's only straight code that is put in--no WYSIWYG editor is allowed for that format).

It can get really annoying when having to collaborate with editors, though (if they don't know how to code). If at all possible, it may be better for you to create HTML classes, since CKeditor is actually trying to help you avoid adding bad code and non-conforming visual design to your layouts.

Sometimes, the solution can be simple, as well--for instance, I use a custom icon font, and span classes are used to display icons in text. Per the developer's instructions, adding it to HTML text would be <span class="[class name]"> </span>. CKedtior interprets that space between the span tags as irrelevant, and strips it out. Adding &nbsp; in place of the space fixes it, and no changes to settings are required.


To configure Text Formats you can go to /admin/config/content/formats

A text format contains filters that change the user input, for example stripping out malicious HTML or making URLs clickable. Filters are executed from top to bottom and the order is important, since one filter may prevent another filter from doing its job. For example, when URLs are converted into links before disallowed HTML tags are removed, all links may be removed. When this happens, the order of filters may need to be re-arranged.

See here for more information on text filters and input formats.

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