0

I'm trying to space out elements inside a Card evenly, but they are not lined-up:

enter image description here

here's the code:

<div className="card">
    <header className="card-header">
        <div className="card-header-info">
            <p>{`#${driver.driverId}`}</p>
            <h1>{driver.name}</h1>
        </div>
        <div className="card-header-info">
            <p>VEHICLE</p>
            <p>{driver.vehicleId}</p>
        </div>
        <div className="card-header-info">
            <p>HOMETOWN</p>
            <p>{driver.hometown}</p>
        </div>
    </header>
</div>

CSS

.card-header-info {
    padding-left: 20px;
    margin-right: auto;
}

I have also tried Bulma (CSS framework) columns but got nothing. Anyone know a slick technique that would achieve this goal while at the same time making the space relative to the size of the Card? I would appreciate any help.

2
  • did you use Card of Bulma? Commented Jul 14, 2022 at 3:31
  • Can you provide the rendered HTML? Better still provide a minimal reproducible example. I would also consider removing the header wrapper and use CSS Grid Commented Jul 14, 2022 at 3:42

1 Answer 1

2

I recommend the following for the header element using css grid:

.card-header {
  display: grid;
  grid-template-columns: 1fr 1fr 1fr;
}
Sign up to request clarification or add additional context in comments.

Comments

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service and acknowledge you have read our privacy policy.

Start asking to get answers

Find the answer to your question by asking.

Ask question

Explore related questions

See similar questions with these tags.