Follow

Keep Up to Date with the Most Important News

By pressing the Subscribe button, you confirm that you have read and are agreeing to our Privacy Policy and Terms of Use
Contact

How to align items horizontal in form field?

I have a sample form just under a table. Like below
enter image description here

I want to strech the form field as same length with the table and I want to align form items horizontally.

My css is:

MEDevel.com: Open-source for Healthcare and Education

Collecting and validating open-source software for healthcare, education, enterprise, development, medical imaging, medical records, and digital pathology.

Visit Medevel

.buttonFooter {
    background-color: gray;
    align-items: center;
    flex-direction: row;
    display: inline-block;
}

And the code is:

<Card className='buttonFooter'>
                <Form className='buttonFooter'>
                    <input type="text" class="form-control" placeholder="First Name" value={firstName}></input>
                    <input type="text" class="form-control" placeholder="Last Name" value={lastName}></input>
                    <Button>Add New Customer</Button>
                </Form>
            </Card>

If I delete form tag and just use css.class for the card then it works (horizontal alignment) but I need to use a form to get the value of input box and send it to a method with button click. How can I align them horizontal and enlarge it with same size with table ?

>Solution :

You can set the width in css using:

width: x; (x being the width of your table)

I haven’t tested it but you can try setting display to flex or inline-flex instead of inline-block

Add a comment

Leave a Reply

Keep Up to Date with the Most Important News

By pressing the Subscribe button, you confirm that you have read and are agreeing to our Privacy Policy and Terms of Use

Discover more from Dev solutions

Subscribe now to keep reading and get access to the full archive.

Continue reading