Place input box at the center of div

Viewed 228976

I have a div, and I want the input box to be place at it's center. How can I do this?

5 Answers

You can just use either of the following approaches:

.center-block {
  margin: auto;
  display: block;
}
<div>
  <input class="center-block">
</div>

.parent {
  display: grid;
  place-items: center;
}
<div class="parent">
  <input>
</div>

Related