Empresas
Empleos
  • Sobre nosotros
  • Soluciones
    • Publicación de vacantes
      Publica tu vacante y recibe candidatos calificados en 48h.
    • Evaluación de candidatos
      500+ pruebas técnicas y psicológicas, más anti-fraude.
    • Headhunting
      Búsqueda ejecutiva a la medida de principio a fin.
    • Nómina + EOR
      Dispersión de nómina y EOR en más de 15 países de LATAM.
  • Precios
  • Empleos

0

117
Vistas
Why can't I get these images with titles to flow horizontally center?

Previously I posed a question here1, and it was answered appropriately to solve my first issue but not my second issue - the first being proper code arrangement and the second being the question I'm talking about. I removed the CSS code that was originally applied, which you can view on original question, and applied the new CSS code as follows:

.img {
  margin: 10px;
}

.grid {
  display: flex;
  flex-wrap: wrap;
  /* max-width: 800px; */
}
  
.grid a {
  display: flex;
  align-items: center;
}

I removed the max-width: 800px; and received the following resultMinimized screen viewFull Screen View.

Adding the max-width: 800px; showed the same results in image. Tried various combinations of CSS with no positive results. The code snippet as follows:

<div className={styles.grid}>
          <div className={styles.imgc}>
          <a href="..\pages\satweather.js">
            <img
              className={styles.img}
              src="weatherbutton.jpg"
              width="100"
              height="50"
              onclick="openModal();currentSlide(1)"> 
            </img>
            <div>&rarr; SatWeather</div>
          </a>
          </div>

/* code continues in repetition for 4 more images 
before ending with */

</div>

Does anyone have any suggestions on what I might try or a solution to this problem? To get these images aligned center and horizontally to the page. Help is appreciated.

Here is desired result, but without space between photo and link to page desired result

Please Note: This is JS, not HTML.

about 4 years ago · Santiago Gelvez
1 Respuestas
Responde la pregunta

0

  • Here is html version of your code.
  • Use display:flex to image container and then, Make one separate element for image box just like here which is image-box set it's anchor tag to display:flex and align-items:center.

* {
  box-sizing: border-box;
  margin: 0;
  padding: 0;
}

.container {
  background-color: #050505;
}

.image-container {
  position: relative;
  display: flex;
  flex-direction: row;
  gap: 15px;
  flex-wrap: wrap;
}

.image-class {
  height: 50px;
  width: 100%;
  object-fit: cover;
}

.image-box a {
  display: flex;
  flex-direction:column;
}
<div class="container">
  <div class="image-container">
    <div class="image-box">
      <a href="javasctipt:void(0);">
        <img src="https://source.unsplash.com/random" alt="image" class="image-class">
        <h1>image titel</h1>
      </a>
    </div>
    <div class="image-box">
      <a href="javasctipt:void(0);">
        <img src="https://source.unsplash.com/random" alt="image" class="image-class">
        <h1>image titel</h1>
      </a>
    </div>
    <div class="image-box">
      <a href="javasctipt:void(0);">
        <img src="https://source.unsplash.com/random" alt="image" class="image-class">
        <h1>image titel</h1>
      </a>
    </div>
    <div class="image-box">
      <a href="javasctipt:void(0);">
        <img src="https://source.unsplash.com/random" alt="image" class="image-class">
        <h1>image titel</h1>
      </a>
    </div>
  </div>
</div>

about 4 years ago · Santiago Gelvez Denunciar
Responde la pregunta
Encuentra empleos remotos

¡Descubre la nueva forma de encontrar empleo!

Top de empleos
Top categorías de empleo
Empresas
Publicar vacante Precios Comercial
Legal
Términos y condiciones Política de privacidad
© 2026 PeakU Inc. All Rights Reserved.
Andres GPT
Recomiéndame algunas ofertas
Necesito ayuda