1

I don't find any code that's aligned if jumbotron class is aligned center.

I just get use the text-align: center, but sign up area don't move.

I find nowhere.

 .jumbotron {

        background-image: url(background.jpg);
        text-align: center;
    }


<div class="jumbotron">
<h1 class="display-4">Hello, world!</h1>
<p class="lead">This is a simple hero unit, a simple jumbotron-style component for calling extra attention to featured content or information.</p>
<hr class="my-4">
<p>It uses utility classes for typography and spacing to space content out within the larger container.</p>


  <form class="form-inline">
  <div class="form-group mb-2">
    <label for="staticEmail2" class="sr-only">Email address</label>

  <div class="form-group mx-sm-3 mb-2">
    <label for="inputPassword2" class="sr-only">Email address</label>
    <input type="password" class="form-control" id="email" placeholder="Your email">
  </div>
  <button type="submit" class="btn btn-primary mb-2">Sign up</button>
</form>

last div included

like below picture

enter image description here

2 Answers2

0

Take a div tag and put your form inside it . Give the div tag a property that is text-align center .it will help you.

Ricky
  • 488
  • 3
  • 14
0

There are so many ways to do it. With bootstrap4, you can use its flexbox utility classes without writing any custom styles.

<div class="jumbotron text-center">
    TEXT
    ...
    <div class="d-flex flex-row justify-content-center">
        <form class="form-inline">
            <div class="form-group ...">
                <label />
                <input />
            </div>
            <button type="submit" />
        </form>
    </div>
</div>

https://jsfiddle.net/davidliang2008/xa62ygzq/24/

enter image description here

David Liang
  • 20,385
  • 6
  • 44
  • 70