0

How to center the input text box of bootstrap?

 <form action="#" method="post" class="akame-contact-form border-0 p-0">
                        <div class="row">
                        <div class="col-lg-12">
                            <input type="text" name="username" class="form-control mb-30" placeholder="Your Name" required style="margin-bottom:15px;">
                        </div>
                    </div>
  • Does this answer your question? [bootstrap asp.net textbox does not center properly](https://stackoverflow.com/questions/37074033/bootstrap-asp-net-textbox-does-not-center-properly) – Liastre Feb 07 '20 at 14:11
  • Does this answer your question? [Place input box at the center of div](https://stackoverflow.com/questions/1281403/place-input-box-at-the-center-of-div) – Mox Feb 07 '20 at 14:20

2 Answers2

0

There are multiple ways to do so. But the easiest is to use .text-center. It sets text-align property of input to center.

.text-center {
    text-align: center;
 }

Read this for more info. https://getbootstrap.com/docs/4.0/utilities/text/#text-alignment Text-align class for inside a table

mahan
  • 12,366
  • 5
  • 48
  • 83
0

I have used bootstrap 4-

<form action="#" method="post" class="akame-contact-form border-0 p-0">
                    <div class="row">
                    <div class="col-lg-6 mx-auto">
                        <input type="text" name="username" class="form-control mb-30" placeholder="Your Name" required style="margin-bottom:15px;">
                    </div>
                </div>
              </form>