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

142
Visualizações
Cómo detener el movimiento de la imagen

Básicamente, mi amigo y yo estamos trabajando en un sitio web de revisión de juegos. Hay un menú donde seleccionas el juego sobre el que quieres leer.

Nuestro problema es que los juegos se mueven cuando cambiamos el tamaño de una imagen (icono del juego) al lado. ¿Cómo podríamos evitar que se mueva?

Aquí está nuestro código:

HTML:

 <!DOCTYPE html> <html> <head> <meta charset="utf-8"> <meta name="viewport" content="width=device-width"> <link href="style.css" rel="stylesheet" type="text/css" /> <title> Just a game review thing </title> </head> <body> <h1>Doesn't have a name yet</h1> <div class="gameLinks"> <a><img src="images/Sea_of_Thieves.png" alt="Sea of Thieves" class="gameLinkImg"></a> <a><img src="images/Sea_of_Thieves.png" alt="Sea of Thieves" class="gameLinkImg"></a> </div> <script src="script.js"></script> </body> </html>

CSS:

 * { margin: 0; padding: 0; } body { background-color: #1a202f; } @font-face { font-family: Bungee; src: url("fonts/Bungee-Regular.ttf"); } h1 { color: whitesmoke; font-family: Bungee, cursive; text-align: center; font-size: 80px; } .gameLinks { margin: 0 200px; } .gameLinkImg { transition: 0.3s ease-in-out; width: 10%; } .gameLinkImg:hover { transition: 0.3s ease-in-out; box-shadow: 8px 8px 30px; width: 12%; }
about 4 years ago · Juan Pablo Isaza
1 Respostas
Responde à pergunta

0

En lugar de alterar una dimensión, podría usar una función de escala. Esto no alterará el posicionamiento de otros elementos.

Depende de si solo desea escalar el ancho o si desea que toda la imagen se haga un poco más grande en cuanto a qué función de escala usar. Este fragmento solo hace que la imagen se agrande por un factor de 12/10.

 <!DOCTYPE html> <html> <head> <meta charset="utf-8"> <meta name="viewport" content="width=device-width"> <link href="style.css" rel="stylesheet" type="text/css" /> <title> Just a game review thing </title> <style> * { margin: 0; padding: 0; } body { background-color: #1a202f; } @font-face { font-family: Bungee; src: url("fonts/Bungee-Regular.ttf"); } h1 { color: whitesmoke; font-family: Bungee, cursive; text-align: center; font-size: 80px; } .gameLinks { margin: 0 200px; } .gameLinkImg { transition: 0.3s ease-in-out; width: 10%; } .gameLinkImg:hover { transition: 0.3s ease-in-out; box-shadow: 8px 8px 30px; transform: scale(calc(12 / 10)); } </style> </head> <body> <h1>Doesn't have a name yet</h1> <div class="gameLinks"> <a><img src="https://picsum.photos/id/1015/200/300" alt="Sea of Thieves" class="gameLinkImg"></a> <a><img src="https://picsum.photos/id/1016/200/300" alt="Sea of Thieves" class="gameLinkImg"></a> </div> <div class="gameLinks"> <a><img src="https://picsum.photos/id/1015/200/300" alt="Sea of Thieves" class="gameLinkImg"></a> <a><img src="https://picsum.photos/id/1016/200/300" alt="Sea of Thieves" class="gameLinkImg"></a> </div> <script src="script.js"></script> </body> </html>

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