0
我希望你能幫助我下面的問題/計劃。引導3 - 垂直居中
我如何中心我的元素引導,使他們總是在顯示屏的中央? 在最好的情況下,這些元素都在監控,智能手機的中心和休息
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>
\t
\t
\t <div class="container">
\t
\t \t <div class="row">
\t \t \t
\t \t \t <div class="col-md-6 col-xs-12 col-sm-12">
\t \t \t
\t \t \t \t <h1 class="text-center">Name this is a h1</h1>
\t \t \t \t
\t \t \t </div> \t
\t \t </div> \t
\t \t \t \t \t
\t \t \t
\t \t \t
\t \t \t
\t \t <div class="row row-centered topo2">
\t \t \t
\t \t \t <div class=" col-centered col-md-6 block2">
\t \t \t \t <h2 class="text-center">Subheading - this is h2</h2>
\t \t \t
\t \t \t </div>
\t \t </div>
\t \t \t
\t \t \t
\t \t \t
\t \t <div class="row"> \t
\t \t \t <div class="col-md-7 col-xs-12 col-sm-12"> \t \t \t
\t \t \t
\t \t \t \t <h4>Progess:</h4>
\t \t \t \t <div class="progress">
\t \t \t \t \t <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%">
\t \t \t \t \t \t 55%
\t \t \t \t \t </div>
\t \t \t \t </div>
\t \t \t \t
\t \t \t </div>
\t \t </div>
\t \t
\t </div>
\t
<!-- 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>
*表,* inline-塊*,* flexbox *或*絕對定位*,無論哪一個都會在您的頁面上創建更少的麻煩。 –