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

207
Views
Center list items horizontally across various widths

I have this container:

export const Container = styled.section<ContainerProps>`
  display: flex;
  justify-content: center;
`;

Which is centering my 3 list items vertically. No matter the width of the page, it's always in the center. I'm trying to achieve the same effect but horizontally. I've tried using float: left; along with controlling the margins and that does work but then the problem is that it doesn't change dynamically with different widths (mobile).

I'm using the following the style the cards within the container. As I have said, it's 3 cards:

export const Card = styled.article`
  border-radius: 50px;
  border: solid 1px #e6e6e6;
  font-size: 12px;
  box-shadow: 5px 10px 10px grey;
`;


This is the section of the return in the component:


        if (name !== null) {
          return (
            <Container>
              <Card>
                <CollectionAvatar
                  image={image}
                  /*name={name || collection}*/
                  type="collection"
                />
                <br></br>
                <br></br>
                {name}
              </Card>
            </Container>
          );
        }
about 4 years ago · Juan Pablo Isaza
1 answers
Answer question

0

This code should work for centering a div on a page horizontally and align the children in a row.

   .card {
  border-radius: 50px;
  border: solid 1px #e6e6e6;
  font-size: 12px;
  box-shadow: 5px 10px 10px grey;
}

.container {
  display: flex;
  justify-content: center;

}

<div class="container">

<div class="card">
  <br></br>
  <br></br>
  {name}
</div>

<div class="card">
  <br></br>
  <br></br>
  {name}
</div>

<div class="card">
  <br></br>
  <br></br>
  {name}
</div>

enter image description here

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!