1
I don’t know how to deal with the following problem.
I was trying to work with the <li class="filme">
, with its responsive size, but as each image has a variable size. When it reaches a certain size the images begin to break the layout. If I set the image size, baby <li class="filme">
to begin to grow more than the image. Yes, the <li>
is in % and the pixel image. If I set the width
da li as auto(to occupy the image size) my layout as it grows becomes a blank space in the layout.
HTML:
<main class="principal">
<section class="section-filmes">
<ul id="lista-filmes" class="lista-filmes">
<!-- Lista de filmes aqui..-->
<li class="filme"> <img src="img-filme"> </li>
</ul>
</section>
</main>
CSS:
img{ max-width 100% }
.lista-filmes::after{
content: '';
display: block;
clear: both;
}
.lista-filmes .filme{
width: 100%;
display: block;
float: left;
background: #fff;
padding: 1rem;
margin-bottom: 1rem;
box-shadow: 0 1px 1px rgba(0,0,0,.2);
}
Note: Movie images are variable sizes, example 400x600 300x450 800x900 and etc.
I wonder if you have any solution to make the images responsive, without breaking the layout.
The idea is that in the end it stays like this: click here to see
But responsive.
the idea is that in the end it looks like this: https://uploaddeimagens.com.br/imagens/imagens-animes-jpg,
– Nicolas Guilherme Matheus
then the images would have a width and height defined example: width: 150px; height: 200px;, but the problem would be the li, which would have variable width and height, and if it did not have it would not be able to follow the layout
– Nicolas Guilherme Matheus
no, what I meant was, I would get images of varying sizes and CSS would set a size for them understood?
– Nicolas Guilherme Matheus
i would use Object-fit: cover; to adjust the image
– Nicolas Guilherme Matheus
Not even I studied about, I just went to research how to leave the images in the same proportion without losing quality, I see that what I want seems more complex than I think it is :S
– Nicolas Guilherme Matheus
Its intention is to leave all the images of the same size and the Lis?
– Sam
Yes, that was my intention, but along the "development", I saw that anyway I did not reach my goal, then I came to the stack :s
– Nicolas Guilherme Matheus
You will have to use javascript, because Lis can vary in height depending on the text... in the example image you sent this does not occur because the text is cut when it is long mt, making it occupy only one line.
– Sam
In the case of images, cutting is inevitable, because the images have variable size.
– Sam
Yes, this I have already adjusted, It was pending even the images, which it seems, my idea would only be possible if the images had standard size
– Nicolas Guilherme Matheus
Yes, otherwise they’ll have cuts on the edges.
– Sam
Yes, since I’m no expert in css, I went to the stack to find out if there is a solution for this case, but thanks for your attention and explanation dvd (again)
– Nicolas Guilherme Matheus