M
M
mrrangerr2020-01-11 20:57:30
css
mrrangerr, 2020-01-11 20:57:30

How to make a photo dynamically resizable?

Good evening. I'm building an app using the Unsplash API and React. How to load images that come with the API so that they fill the empty space and stand next to each other?
You need to do it like on the screen. Thank you!
5e1a0cb8f0741583310609.jpeg

Answer the question

In order to leave comments, you need to log in

1 answer(s)
P
Pavel Ataykin, 2020-01-12
@mrrangerr

This layout is called "Masonry Layout". Accordingly, the easiest way is to use ready-made plugins for react, for example this one: https://www.npmjs.com/package/react-masonry-component
If you need to develop "your" mechanism, then google by the name of the layout.
PS If you do not need to respect the hierarchy of images, then you can use the css property column-count, an implementation example can be found here: https://w3bits.com/css-masonry/

Didn't find what you were looking for?

Ask your question

Ask a Question

731 491 924 answers to any question