私はいくつかの行を整列するいくつかの問題があります。ビューポートの高さを100%とするセクションを表示しています。このセクションを画面に表示すると、このセクションのみが表示されます。行を100%幅にするにはどうすればよいですか?
このセクションには、タイトルとサブタイトルがあります。タイトルはセクションの上部近くに表示する必要がありますが、セクションの中央に垂直に字幕を表示する必要があります。したがって、画面の高さが1000px(このセクションの高さが1000pxになる)であれば、字幕は500px付近に表示されます。私のセクションには、現在、以下の
<section class="block-hero">
<div class="container container-table">
<div class="row vertical-top-row">
<div class="col-md-12 centerText">
<h1 class="heroTitle">Some Title</h1>
</div>
</div>
<div class="row vertical-center-row">
<div class="col-md-12 centerText">
<h2 id="subTitle">Some<br>Text</h2>
</div>
</div>
</div>
</section>
のように見え、CSSはとても
html, body {
height:100%;
}
.site-wrapper {
overflow: hidden;
position: relative;
top: 0;
width: 100%;
}
.block-hero {
height:100%;
width: 100%;
z-index: 300;
overflow:hidden;
}
.container-table {
display: table;
width:100%;
height:100%;
}
.vertical-top-row {
display: table-cell;
vertical-align: top;
}
.vertical-center-row {
display: table-cell;
vertical-align: middle;
height:100%;
}
.centerText {
text-align: center;
}
#subTitle {
width: 100%;
}
私は私が今持っていますfiddle一つの問題は、私は現在、それを持っているかである私の行はもはや100ではない持っているようです%幅。これは、字幕が正確に中央にセンタリングされていないことを意味します。私は垂直方向の整列が働いていると思うが、今はテキストを中央に集中させる必要がある。
これを行うにはどうすればよいですか、現在のものを変更する必要がありますか?
おかげ
btw、bootstrapは実際に 'text-center {text-align:center;}として定義されている' text-center'クラスを持っています。 } ' –