Logo Questions Linux Laravel Mysql Ubuntu Git Menu
 

Responsive images in CKEditor?

Tags:

ckeditor

Is there a way to set an image width to 100% of its parent?

At the minute I'm using Enhanced Image with a nicely styled figure tag for captions, but until the image fits the width of the figure it's pretty much useless!

Thanks!

like image 509
bababababa Avatar asked Oct 25 '25 13:10

bababababa


2 Answers

Add this in your CSS file:

img {
    max-width: 100%;
    height: auto !important;
}

Or, try this gist.

like image 63
Grey Li Avatar answered Oct 27 '25 18:10

Grey Li


After trying for so long I got a manual solution for making the image responsive in the CKEditor Django. After a adding the image in editor, put "style width:100%" manual in Image Properties

1

This work in my case but we have to manually add this field.

like image 24
Anish Var Shrestha Avatar answered Oct 27 '25 18:10

Anish Var Shrestha