私は、すべての画面を中心にしたいテキストセクションを持っています。しかし、画面サイズが大きくなると、画面の一番上にとどまり、画面の一番下が空のままになり、見栄えが悪くなります。さまざまな画面サイズで、ブートストラップでHTMLテキストセクションを中央に配置できません。
どのように上に置かれ、センタリングされていないかのコードとスクリーンショットを貼り付けています。
また、ページのパディングを上から上に調整するコードにその部分をマークしました。すべての画面サイズの中心にする方法を知らないdiv要素の内側を中心おかげ
body {
width: 100%;
height: 100%;
font-family: Lora,"Helvetica Neue",Helvetica,Arial,sans-serif;
color: #fff;
background-color: #000;
}
html {
width: 100%;
height: 100%;
}
h1,
h2,
h3,
h4,
h5,
h6 {
margin: 0 0 35px;
text-transform: uppercase;
font-family: Montserrat,"Helvetica Neue",Helvetica,Arial,sans-serif;
font-weight: 700;
letter-spacing: 1px;
}
p {
margin: 0 0 23px;
font-size: 18px;
line-height: 1.5;
}
@media(min-width:768px) {
p {
text-align: justify;
text-justify: inter-word;
margin: 0 0 20px;
font-size: 20px;
line-height: 1.6;
}
}
a {
color: #3bc692;
-webkit-transition: all .2s ease-in-out;
-moz-transition: all .2s ease-in-out;
transition: all .2s ease-in-out;
outline: 0!important;
}
@media(min-width:768px) {
.adjust-this {
padding-left: 55px; padding-right: 55px;
}
}
.content-section {
padding-top: 85px;
}
@media(min-width:767px) {
.content-section {
padding-top: 50px; /*This is where you can adjust padding for the section*/
width: 100%;
height: 100%;
}
}
.content-section p {
opacity: 0.9;
font-family: 'Domine';
font-size: 19px;
font-weight: 500;
}
a:hover,
a:focus {
text-decoration: none;
color: #1d9b6c;
}
.greeting {
padding-top: 5px;
margin-bottom: 20px;
}
<head>
<meta charset="utf-8">
<meta http-equiv="X-UA-Compatible" content="IE=edge">
<meta name="viewport" content="width=device-width, initial-scale=1">
<meta name="description" content="">
<meta name="author" content="">
<title>About</title>
<!-- Bootstrap Core CSS -->
<link href="css/bootstrap.min.css" rel="stylesheet">
<!-- Custom CSS -->
<link href="about.css" rel="stylesheet">
<!-- Custom Fonts -->
<link href="font-awesome/css/font-awesome.min.css" rel="stylesheet" type="text/css">
<link href="http://fonts.googleapis.com/css?family=Open Sans:400,700,400italic,700italic" rel="stylesheet" type="text/css">
</head>
<body>
<!-- About Section -->
<article id="about" class="content-section">
<div class="container">
<div class="row">
<div class="col-sm-10 col-sm-offset-1 text-left adjust-this">
<h2 class="text-center greeting">Hi there!</h2>
<p>Contrary to popular belief, Lorem Ipsum is not simply random text. It has roots in a piece of classical Latin literature from 45 BC, making it over 2000
</p>
<p>
Lorem Ipsum is simply dummy text of the printing and typesetting industry. Lorem Ipsum has been the industry's standard dummy text ever since the 1500s, when an unknown printer took a galley of type and scrambled it to make a type specimen book.
</p>
<p>
It has survived not only five centuries, but also the leap into electronic typesetting, remaining essentially unchanged. It was popularised in the 1960s with the release of Letraset sheets containing Lorem Ipsum passages, and more recently with desktop publishing software like Aldus PageMaker including versions of Lorem Ipsum.
</p>
<p>
It uses a dictionary of over 200 Latin words, combined with a handful of model sentence structures, to generate Lorem Ipsum which looks reasonable. The generated Lorem Ipsum is therefore always free from repetition, injected humour, or non-characteristic words etc.
</p>
</div>
</div>
</div>
</article>
</body>
はあなたが求めているものについて、より明確にすることができます。また、これは簡単なGoogleの質問のように思えます。 – Ale
このテキストを大きな画面の中央に配置し、空の底面の上部に留まらないようにします。 – tsaebeht
ここでいくつかのセンタリング方法を確認できます:https://css-tricks.com/centering-css-complete-guide/ – Alvaro