0

I put text-center but it is only horizontal center, is there vertical center too?

    <div class="container text-center">
          <h1>hello wordl</h1>
          <a href="#">Login</a>
          <a href="#>Sign Up</a>
    </div>
truthlies uchiha
  • 159
  • 1
  • 1
  • 10
  • Simple bootstrap classes won't help you to the job done. you need to add custom CSS. follow the link https://stackoverflow.com/a/50358329/6696948 – Sanjeet kumar Dec 24 '18 at 06:50

2 Answers2

0

Define a custom class

.vertical-align {
    display: flex;
    align-items: center;
}
Jahanzeb Awan
  • 164
  • 12
0

<!doctype html>
<html lang="en">
  <head>
    <!-- Required meta tags -->
    <meta charset="utf-8">
    <meta name="viewport" content="width=device-width, initial-scale=1, shrink-to-fit=no">

    <!-- Bootstrap CSS -->
    <link rel="stylesheet" href="https://stackpath.bootstrapcdn.com/bootstrap/4.1.3/css/bootstrap.min.css" integrity="sha384-MCw98/SFnGE8fJT3GXwEOngsV7Zt27NXFoaoApmYm81iuXoPkFOJwJ8ERdknLPMO" crossorigin="anonymous">

    <title>Hello, world!</title>
  </head>
  <body>
  
     <div class="m-5 container">
          <h1 class="text-center">hello world</h1>
          <div class="text-center p-3">
          <a href="#" class="btn btn-success mr-2">Login</a>
          <a href="#" class="btn btn-primary">Sign Up</a>
          </div>
    </div>

    <!-- Optional JavaScript -->
    <!-- jQuery first, then Popper.js, then Bootstrap JS -->
    <script src="https://code.jquery.com/jquery-3.3.1.slim.min.js" integrity="sha384-q8i/X+965DzO0rT7abK41JStQIAqVgRVzpbzo5smXKp4YfRvH+8abtTE1Pi6jizo" crossorigin="anonymous"></script>
    <script src="https://cdnjs.cloudflare.com/ajax/libs/popper.js/1.14.3/umd/popper.min.js" integrity="sha384-ZMP7rVo3mIykV+2+9J3UJ46jBk0WLaUAdn689aCwoqbBJiSnjAK/l8WvCWPIPm49" crossorigin="anonymous"></script>
    <script src="https://stackpath.bootstrapcdn.com/bootstrap/4.1.3/js/bootstrap.min.js" integrity="sha384-ChfqqxuZUCnJSK3+MXmPNIyE6ZbWh2IMqE241rYiqJxyMiZ6OW/JmZQ5stwEULTy" crossorigin="anonymous"></script>
  </body>
</html>
Saurabh Mistry
  • 12,833
  • 5
  • 50
  • 71