Business
Jobs
  • About Us
  • Solutions
    • Job Postings
      Post your job and receive qualified candidates in 48h.
    • Candidate Assessments
      500+ technical and psychological tests, plus anti-fraud.
    • Headhunting
      Tailor-made executive search from start to finish.
    • Payroll + EOR
      Payroll dispersal and EOR across 15+ LATAM countries.
  • Pricing
  • Jobs

0

127
Views
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 answers
Answer question

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 Report

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 Report

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 Report
Answer question
Find remote jobs

Discover the new way to find a job!

Top jobs
Top job categories
Business
Post vacancy Pricing Sales
Legal
Terms and conditions Privacy policy
© 2026 PeakU Inc. All Rights Reserved.
Andres GPT
Show me some job opportunities
There's an error!