Editor removes style from div

  • Unknown's avatar

    I’ve disabled the visual editor, and I’m just using HTML. When I write this:

    <div id="attachment_19" class="wp-caption alignright" style="width:185px"><img class="size-full wp-image-19" title="liftarm-measurements1" src="http://redmondcbagstock.files.wordpress.com/2008/12/liftarm-measurements1.png?w=175" alt="Comparison of studded and studless parts; measurements." width="175" />
    <p class="wp-caption-text">Comparison of studded and studless parts; measurements.</p>
    </div>

    I find that the style=”width:185px” is removed from the first div, rendering the image with caption incorrectly (the caption div ends up taking as much space as is needed by the wp-caption-text).

    How do I prevent the editor from messing with my HTML?

  • Unknown's avatar

    It is stripping out the style, because CSS style selectors need ; to be properly closed.

    It should be:

    style="width:185px;"

    Notice the character after the px.

  • The problem with attributes getting stripped should be fixed now. You can use the Post Revisions box on the Edit Post tab to recover an earlier version of your post with formatting intact.

  • Unknown's avatar

    Thank you, tellyworth, it is working now! I appreciate your attention to this issue.

  • The topic ‘Editor removes style from div’ is closed to new replies.