I have basic knowledge in css
and tried to center these images within a div
to give appearance to cards, but I can not position the images in the center. Here is the code that I tried, what is commented is the last thing I tried to do.
.container-img {
width: 250px;
height: 150px;
box-shadow: 5px 5px 10px rgba(59, 58, 58, 1);
border-radius: 10px;
margin: 10px auto;
display: block;
overflow:hidden;
}
.container-img img{
width:100%;
/* display: block; */
/* margin: auto auto; */
/* text-align: center; */
/* object-fit: contain; */
}
<!DOCTYPE html>
<html lang="en">
<head>
</head>
<body>
<div class='container-img'>
<img src="https://example.com.au/wp-content/uploads/2020/03/EXAMPLE-LOGO-BLACK.png" alt='ejemplo' />
</div>
</body>
</html>
you can use this in your div class
To center an image, which I understand you want vertically, you can use flex and center align as follows:
Greetings. ;)
You can use:
What it does is your image uses all the space
.container-img
and adjusts the image to the proper size according to its dimensions: