Z
Z
ZaurK2016-03-03 12:21:38
PHP
ZaurK, 2016-03-03 12:21:38

Responsive images in tinyMCE, how to do?

Hello! When loading images through a text editor, tinyMCE noticed this feature. If you change the image size after loading, then the width and height parameters in pixels are added to it, this leads to a loss of image adaptability, when the browser window narrows, the image shrinks disproportionately. Tried to set in styles
img{
max-width: 100% !important;
}
but doesn't help. How to solve this problem? Thank you.

Answer the question

In order to leave comments, you need to log in

2 answer(s)
V
Vitaly Kirenkov, 2016-03-03
@ZaurK

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

A
Andrew Ghostuhin, 2016-03-03
@Torin_Asakura

First, look in which container the image is located and only then you can do as Vitaly Kirenkov suggested , well, that is:

.parentContainer
  > img
    max-width: 100%
    height: auto

I used the SASS syntax, it's more convenient ^^
However, make it render last, then !important is not needed

Didn't find what you were looking for?

Ask your question

Ask a Question

731 491 924 answers to any question