I've got the WYSIWYG module installed and the TinyMCE javascript library as well. I've created a text format "Rich Text" which is similar to Filtered HTML but I've added more allowed tags.

I insert an image into my text and I set it to align left which adds float: left to the markup. However, when I save and view the page, the float: left has been stripped out.

I can't find any options in the WYSIWYG configuration or my "Rich Text" format that allows me to control this. Am I missing it somewhere?

Why is my float: left getting stripped out?

3 Answers 3


My solution:

I downloaded a new module called WYSWIWYG Filter. On my Text Format, I turned off the Limit allowed HTML tags option and instead enabled the WYSIWYG Filter option. Then below in the WYSIWYG Filter settings, I configured the allowed HTML elements like so:


And I checked all the boxes to allow margins, padding, floating, etc.

  • This solution also works in Drupal 6
    – HorusKol
    Jul 16, 2012 at 0:53
  • I'm currently using it on Drupal 7 and it's working. Jul 16, 2012 at 3:37

You can do some of this (if I remember correctly) from a given WYSIWYG profile preferences. You can add custom classes to apply to elements such as:

float left=float_left

then you make a CSS rule .float_left: { float: left } ;

You may find the WYSIWYG_Filter module to be helpful in your needs.

Basically the WYSIWYG editor allows only certain things by default for safety. Drupal Input Formats further limit/allow what is allowed.

  • This is just a workaround and not the explanation of why it's happening or how to fix it. I need my users to be able to use the built-in methods of arranging their text in a WYSWYG fashion using the WYSIWYG editor. Teaching them and asking them to use a clunky work-around isn't going to work in this case. Jun 11, 2012 at 17:46

This does not help your exact question, but it is best to avoid WYSIWYG editors, it can often end up messing up the code or at least putting it in a way you cannot understand or draw sense from.

  • 1
    WYSIWYG works just fine and hyping your website is bad form. Oct 5, 2012 at 21:39

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service and acknowledge you have read our privacy policy.

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