我希望你能帮助我解决以下问题/计划。
如何将我的元素置于Bootstrap中心,以便它们始终位于显示器的中心? 在最好的情况下,元素位于显示器,智能手机和休息的中心
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>