how to fix alignment using flex box
hello I am trying to create a patient details modal. First Name and Last Name looks good but age, sex is not align with the first name and last name and phone email too but city and state is okay with first name and last name.
![](https://cdn.answeroverflow.com/1113794657697140746/Screenshot_2023-06-01_at_5.09.46_PM.png)
9 Replies
unable to send the code so sharing screenshot of the code
![](https://cdn.answeroverflow.com/1113795511456104499/Screenshot_2023-06-01_at_5.15.11_PM.png)
there's instructions on sharing code in #How To Ask Good Questions
sir I tried to follow the rules but dont know where i amm wrong. I need helo with field alignments
not necessarily a rule, just a helpful list of tips 🙂 people are more likely to help with code they can run, or at least read and/or copy paste.
Sure sir will do that in a minute by dividing every parts
to answer your question, flexbox isn't really made to fix alignments, by default it gives elements the space they want within the row they're in and different rows have no influence on each other. You can force them to align by setting widths on the elements, but that's potentially bad practice.
it's probably easier to use grid in this case, because grids will align by columns and rows
git it sir thanks a lot
thanks a lot sir, manage to do it with the grid
![](https://cdn.answeroverflow.com/1113806507650330785/Screenshot_2023-06-01_at_5.58.57_PM.png)
nice, glad you got it fixed!