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

110
Visualizações
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 Respostas
Responde à pergunta

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 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