P粉8484421852023-09-06 00:20:41
The important thing is the output, instead of calling the image via API, we can use CSS to handle the result.
The movie title pushes the images down because they are in the same container so we have to give them height.
The images have different proportions, so you can use object-fit: cover
to crop the image at the maximum size with the minimum image height.
On mobile: You need to set overflow
to visible
and remove the padding
.container- too True (otherwise there would be multiple extra spaces) and only added to the parent. child
from
Something like this would be done:
.container-child p { height: 50px; text-align: center; display: block; } /*from here the responsive code*/ @media (max-width:1624px){ .container-child img { object-fit: cover; max-width: 500px; max-height: 709px; /*the smallest image*/ width: 100%; height: 100%; } } @media (max-width: 768px) { .container-child { padding-top: 0em; display: inline-block; text-align: center; } #test { margin-top: 130px; display: inline-block; text-align: center } html, body { overflow: visible; background: #000; } }