How to set up responsive images in the Summernote Text Editor

Summernote applies a fixed width to images. This can be frustrating, but there's a solution.

2 years ago

SubjectPoint is built on top of the Laravel Framework, and it uses the open-source Summernote text editor for creating and editing blog posts. This works great, but frustratingly, Summernote applies a fixed width to images. Even more frustratingly, any edits to the image property are overwritten by Summernote. This leads to images failing to resize according to the size of the browser window.

To fix this, add this bit of code to the bottom of the page (note that this only works if you're loading jQuery, which you should be as Summernote uses jQuery):

    $("img").css("max-width", "100%");

This will ensure that the image is never wider than the content, and that images will be resized accordingly no matter how large or small the browser window is. Since we're also leaving the width property alone, images will never scale wider than they should. It is kind of an ugly hack, but it gets the job done without having to modify Summernote's source code.

Click here to read more information about Summernote

Post Comments(7)


Cialis For Sale Canada Aliclescadia <a href=>buy cialis online 20mg</a> felpnoretelt cialis for hypertension

1 month ago


This post just ended my long frustrating non responsive images on small devices. Thanks for the info

5 months ago


Thanks for the tip!

6 months ago



8 months ago


Happy Male Viagra - buy cialis online reddit Why Cialis Cost So Much <a href=>canadian cialis</a> Viagara Overnight

8 months ago


Cheapest Viagra <a href=>daily cialis online</a> Xenical Donde Compro Online Usa <a href=>buy cialis pills</a> Zentel 400mg Cheapeast No Physician Approval

9 months ago


Propecia Mental Risks <a href=>Cialis</a> Allpills <a href=>Buy Cialis</a> Viagra Generika Wirkung

10 months ago

Leave a reply