0

I have the following layout tusing react JS. enter image description here

this the code I'm using to generate each one of these checkboxes

const CheckBoxItem = ({ Label, item, paramField, change }) => {
    return (
        <div className="Search-Input-CheckBox-Item"   >
            <input type="checkbox" checked={item} onChange={

                () => {

                    change()
                }} />

            <p className="Search-Input-Check-Label">{Label}</p>
        </div>
    )

}

the parent div of the items

 <div style={{ paddingLeft: '1%', paddingRight: '1%', borderBottom: '1px solid rgba(255,255,255,.6' }}>
                <div style={{ display: 'flex', flexDirection: 'row', alignItems: 'center', justifyContent: 'space-between', flexWrap: 'wrap' }}>

I'm using justify-between to distribute the items horizontally, However I would each one of them to be vertically aligned. Can anyone give me some hint on how to do that?

1
  • proberly the easiest way would be CSS-Grid Commented Aug 18, 2021 at 14:18

1 Answer 1

1

I would use grid instead of flex, your second div could then look something like this

<div style={{ display: 'grid', gridAutoFlow: 'row', gridTemplateColums: "repeat(5, minmax(0, 1fr))", gap: "1rem" }}>
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.