Skip to content

How do I make the form fields beneath one another and not side by side? #148151

Discussion options

You must be logged in to vote

Modify the <form> section in your CSS, like the following:

form {
  text-align: center;
  display: flex;
  flex-direction: column;
  align-items: center;
  gap: 1rem;
}
  • flex-direction: column arranges them in a vertical column.
  • align-items: center puts them all in the center.
  • gap: 1rem adds spacing between form fields.

For a bit of extra style, you might want to add these additional CSS rules:

input, select {
  width: 200px;
  padding: 0.5rem;
  font-size: 1rem;
}

Replies: 1 comment 2 replies

Comment options

You must be logged in to vote
2 replies
@Shivraj957
Comment options

@lemorage
Comment options

Answer selected by Shivraj957
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
Code Search and Navigation Search, navigate, and understand code on GitHub Question
2 participants