Empresas
Empregos
  • Sobre nós
  • Soluções
    • Publicação de vagas
      Publique sua vaga e receba candidatos qualificados em 48h.
    • Avaliações de candidatos
      Mais de 500 testes técnicos e psicológicos, mais anti-fraude.
    • Headhunting
      Busca executiva personalizada do início ao fim.
    • Folha de Pagamento + EOR
      Dispersão de folha e EOR em mais de 15 países da LATAM.
  • Preços
  • Empregos

0

154
Visualizações
Make CardMedia Images fit its content in MUI 5

I want my images to fully fit the CardMedia. Yet since they are of different heights and widths, some of them get cut like so:

enter image description here

Also upon resizing, some images get cut as well:

enter image description here

This is the code for the CardMedia part:

   <Card
      raised
      sx={{
        maxWidth: 280,
        margin: "0 auto",
        padding: "0.1em",
      }}
    >
      <CardMedia
        component="img"
        height="250"
        image={product.img_urls[0]}
        alt={product.name}
        title={product.name}
        sx={{ padding: "1em 1em 0 1em" }}
      />
      // Other Content
    </Card>

Overall, I want to achieve something like this but with all the cards in the same height and width:

enter image description here

Is there any way I can fix this or do I need to resize each image individually?

about 4 years ago · Juan Pablo Isaza
1 Respostas
Responde à pergunta

0

Try this

parent-image-element {
 width: 100px;
}

image {
 width: 100%;
 max-height: 100px;
}
about 4 years ago · Juan Pablo Isaza Relatório
Responde à pergunta
Encontrar trabalhos remotos

Descubra a nova forma de encontrar um emprego!

melhores empregos
Principais categorias de trabalho
Empresas
Postar vaga Preços Comercial
Jurídico
Termos e Condições Política de privacidade
© 2026 PeakU Inc. All Rights Reserved.
Andres GPT
Recomende algumas ofertas para mim
Preciso de ajuda