Question: Responsive images on edit mode
See original GitHub issueMy img
elements have styles img.img-responsive { display: block; max-width: 100%; height: auto; }
When I’m on edit mode, img
elements are changed to div
, and they are given background-image
property.
They are not displayed auto sizing…
I hope that div
contain origin img
which set invisible (no doing none display) at least.
Or is there another way? recommend please.
Issue Analytics
- State:
- Created 6 years ago
- Comments:11 (4 by maintainers)
Top Results From Across the Web
Responsive images - Learn web development | MDN
Resolution switching: The problem whereby you want to serve smaller image files to narrow-screen devices, as they don't need huge images like ...
Read more >A Guide to the Responsive Images Syntax in HTML - CSS-Tricks
This guide is about the HTML syntax for responsive images (and a little bit of CSS for good measure). We'll go over srcset...
Read more >Responsive images: How they work – and how to use them ...
The goal is to have a component, where a developer (or editor!) picks a configuration (preset) from a drop-down, for instance “Art Direction ......
Read more >How to make Images Responsive with Examples - BrowserStack
Here's how to create responsive background images with CSS: Use the background-size property to encompass the viewport. Give this property a ...
Read more >glass mapper - How can I make responsive images editable?
There are a couple good ways to do this. Provide a different interface when the page is in edit mode. Image with retina/non-retina...
Read more >Top Related Medium Post
No results found
Top Related StackOverflow Question
No results found
Troubleshoot Live Code
Lightrun enables developers to add logs, metrics and snapshots to live code - no restarts or redeploys required.
Start FreeTop Related Reddit Thread
No results found
Top Related Hackernoon Post
No results found
Top Related Tweet
No results found
Top Related Dev.to Post
No results found
Top Related Hashnode Post
No results found
Top GitHub Comments
First, to start, I want to point out that ContentTools states that the editor does not work well on mobile devices. More importantly, at least from my observations, it doesn’t have native support for responsive displays. Nor does it have native support for Bootstrap, which I am assuming you are using based on that class name. That said, you can achieve this on your own; in fact, it is how I use it. I don’t have mobile support for the edit mode completely perfect, but that is an issue of screen real estate and not something I care to fix.
Because of all that, when the content switches to edit mode and your img tags become divs, the Bootstrap CSS no longer applies - that is really why the responsive images aren’t working. You should be able to add some CSS to the editor pages that appies the Bootstrap CSS from img.img-responsive, which is:
{ display: block; max-width: 100%; height: auto; }
to the divs. Try this:You could be having another problem though. Does the div in edit mode have the img-responsive class on it? If not, the easiest way to handle that will be to add a supported style for it, like this:
Personally, I inject that class on my images when they get inserted. That’s done like this:
Moving forward, if these things happen, just keep in mind that by wanting to use the ContentTools editor with Bootstrap and a responsive display, you will have to manually add support for it like this.
I hope this helps you. Let us know if you get the problem resolved.
No problem 😃 This plugin is still an excellent plugin and I thank you for giving it to us !
That’s why I criticize some part of it, I’m french and we have a proverb that says :
Which could be translated like that :
That’s what I’m doing with your plugin 😃