0

I hope you can help me with following problem/plan.

How can I center my elements in Bootstrap so that they are always in the center of the monitor? In best case, the elements are in the center of the monitor, smartphone and rest

body {
    background: #222;
    font-family: 'Raleway', sans-serif;
}

.container {
    position: relative;
    top: 10%;
}


topo1 {
    color: #eee;
    font-weight: lighter;
}

h2 {
    color: #ddd;
    font-weight: lighter;
}

h4 {
    color: #bbb;
    font-weight: lighter;
}

.progress-bar-custom {
    font-family: "Helvetica";
}
<!DOCTYPE html>
<html lang="en">
  <head>
    <meta charset="utf-8">
    <meta http-equiv="X-UA-Compatible" content="IE=edge">
    <meta name="viewport" content="width=device-width, initial-scale=1">
    <!-- The above 3 meta tags *must* come first in the head; any other head content must come *after* these tags -->
    <title>Under Construction</title>

    <!-- Bootstrap -->
    <link href="css/bootstrap.min.css" rel="stylesheet">
    <link href="style.css" rel="stylesheet">

    <!-- HTML5 shim and Respond.js for IE8 support of HTML5 elements and media queries -->
    <!-- WARNING: Respond.js doesn't work if you view the page via file:// -->
    <!--[if lt IE 9]>
      <script src="https://oss.maxcdn.com/html5shiv/3.7.3/html5shiv.min.js"></script>
      <script src="https://oss.maxcdn.com/respond/1.4.2/respond.min.js"></script>
    <![endif]-->
  </head>
  <body>
    
 
 
 <div class="container">
 
  <div class="row">
   
   <div class="col-md-6 col-xs-12 col-sm-12">
   
    <h1 class="text-center">Name this is a h1</h1>
    
   </div> 
  </div> 
     
   
   
   
  <div class="row row-centered topo2">
   
   <div class=" col-centered col-md-6 block2">
    <h2 class="text-center">Subheading - this is h2</h2>
   
   </div>
  </div>
   
   
   
  <div class="row"> 
   <div class="col-md-7 col-xs-12 col-sm-12">   
   
    <h4>Progess:</h4>
    <div class="progress">
     <div class="progress-bar progress-bar-striped progress-bar-success progress-bar-custom active" role="progressbar" aria-valuenow="55" aria-valuemin="0" aria-valuemax="100" style="width: 55%">
      55%
     </div>
    </div>
    
   </div>
  </div>
  
 </div>
 
    <!-- jQuery (necessary for Bootstrap's JavaScript plugins) -->
    <script src="https://ajax.googleapis.com/ajax/libs/jquery/1.12.4/jquery.min.js"></script>
    <!-- Include all compiled plugins (below), or include individual files as needed -->
    <script src="js/bootstrap.min.js"></script>
  </body>
</html>
interesting-name-here
  • 1,851
  • 1
  • 20
  • 33
L4rs
  • 35
  • 5
  • *table*, *inline-block*, *flexbox* or *absolute positioning*, whichever would create less trouble further with your page. – Dennis Novac Jan 11 '17 at 20:51

1 Answers1

0

You need use "Flexbox" read this

CrsCaballero
  • 2,124
  • 1
  • 24
  • 31