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

135
Vistas
CSS grid and flex box alignment issues

so I was making this layout and i can't get the header to be aligned properly I want to move the button and heading to the red boxes enter image description here

The code is as follows:

<div class="main">
  <div class="header">
    <h1 class="notes__title">Notes</h1>
    <button class="notes__create">Create</button>
  </div>
  <div class="notes">
    <div class="note">
      <h3 class="note__title">Note Title</h3>
      <div class="note__body">Text....</div>
    </div>
  </div>

and the CSS

.main {
    display: flex;
    width: 100%;
    align-items: center;
    flex-direction: column;
}

.header {
    display: flex;
    width: 100%;
    justify-content: space-around;
    align-items: center;
    margin: 10px 0px;
}

.notes__title {
    color: #fff;
}
.notes {
    max-width: 1200px;
    margin: 0 auto;
    display: grid;
    grid-gap: 1rem;
    grid-template-columns: repeat(auto-fit, minmax(300px, 1fr));
}

please help

about 4 years ago · Juan Pablo Isaza
3 Respuestas
Responde la pregunta

0

You're using space-around which is what causes the effect you are seeing.

Try:

.header {
    display: flex;
    width: 100%;
    justify-content: space-between;
    align-items: center;
    margin: 10px 0px;
}
about 4 years ago · Juan Pablo Isaza Denunciar

0

.header {
    display: flex;
    width: 100%;
    justify-content: space-between;
    align-items: center;
    margin: 10px 0px;
    max-width: 1200px;
}
about 4 years ago · Juan Pablo Isaza Denunciar

0

ok so i did this and it worked although I am not happy with the solution, i wanted to achieve it with flex box only#

.main {
    max-width: 960px;
    margin-right: auto;
    margin-left: auto;
    padding-right: 15px;
    padding-left: 15px;
    min-height: 100vh;
}

.header {
    display: flex;
    width: 100%;
    justify-content: space-between;
    align-items: center;
    margin: 10px 0px;
}
about 4 years ago · Juan Pablo Isaza 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