I want a div containing three images and I'd like the images stacked vertically.
I've set the div width to the width of my images and that doesn nothing. Here's 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 taking a look.
Answer: Use the CSS vertical-align Property You can align an image vertically center inside a <div> by using the CSS vertical-align property in combination with the display: table-cell; on the containing div element.
To center an image vertically, you can wrap it in a block element like a div and use a combination of the CSS position property, the left and top properties, and the transform property.
Use the line-height Property to Center the Text Vertically in CSS. We can set the height of the line-height property as the div to center the text vertically in CSS. The line-height property specifies the height of a line. It can be illustrated by creating a border of the div element.
set your images to display: block
, and they should stack vertically.
If you love us? You can donate to us via Paypal or buy me a coffee so we can maintain and grow! Thank you!
Donate Us With