Please note that the forum isn't realy used anymore.

If you have questions, want support or just simply want to talk to us you can find us on slack.

 

Remove inline style height and width in CKeditor

Everytime I place an image in the editor it places an inline style with height and width. In reponsive sites this is unwanted.

Does anybody know how to remove this function from the editor?

I read about an 'Enhanced Image Plugin' for CKEditor here. Seems to solve the inline-style problem. No inline styles anymore. But I haven't tried this plugin.

I had the same problem on a responsive website. How I do it: I just enter the dimensions (300x500 for example) that I want in CKEditor when I insert the image. That's fine for the desktop version of the website, but I want the image to take the full width of the screen on very small screens (phones). So I ignored the inline styles and used this to resize the image to it's container/parent width (put this inside a media query):

.content img {
    min-width: 100%;
    height: auto !important;
}

The !important let's you override the height (specified by the inline css) and setting it to auto makes sure it keeps the aspect ratio, but don't use it too often! The min-width makes sure that the image width is minimum 100% so it ignores the inline style width.

Comment

The forum is deprecated in favor of our Slack channel, which provides real-time support for your issues.

Join us on Slack here: https://fork-cms.herokuapp.com/