I
I
Ivan Zheludkov2015-10-07 00:27:01
css
Ivan Zheludkov, 2015-10-07 00:27:01

How to make an image proportionally smaller when using flexbox?

Here is an example on codepen . I have styles written in Less, so there is also less. But this should not complicate the task.
Here's the page I'm working on. There, the picture has width: auto and it does not scale at all.
In general, if you reduce the window, then the picture, when it stops fitting into the block, will decrease, everything is as it should. Only the height will not change. If you do not use flexboxes, then everything is ok, the pictures always decrease proportionally. But here I need flexboxes.
Thank you for your time.

Answer the question

In order to leave comments, you need to log in

1 answer(s)
N
Nazar Mokrinsky, 2015-10-07
@webvany

I only see the option to wrap <img>in some kind of container, for semantics it could be <picture>. Scaling <img>is kind of magical, it doesn't work with most other elements, so I don't think it will work directly. I love pretty solutions, but that doesn't seem to be the case.

Didn't find what you were looking for?

Ask your question

Ask a Question

731 491 924 answers to any question