How can I stack images vertically in a div

I want the div to contain three images, and I would like the images to be arranged vertically. I set the width of the div to the width of my images, and that doesn't mean anything. Here is my code:

.detailImgWrapper { display: inline; position: relative; width: 25px; top:-210px; } .detailImgWrapper img { visibility: hidden; padding: 0; padding-top: 10px; display: inline; width: 25px; height: 25px; } 

Thanks for watching.

+4
source share
2 answers

set your images to display: block and they should stack vertically.

+11
source

The combination of a parent with a display: inline and child as a display: block is a method that I use to arrange elements horizontally with a dimension. Display: a block is needed to give size (i your pad padding).

The code you wrote seems to work to align the images horizontally, and not to vertically arrange them. So, I wonder what display function: inline serves in the parent?

+1
source

Source: https://habr.com/ru/post/1386965/


All Articles