Bootstrap4の文書によると、定義済みのクラスalign-items-center
とjustify-content-center
を使用して、コンテンツを縦横に整列させることができます。私はBootstrap4のドキュメントの例を試して、それが動作するはずですが、次のコードでalign-items-center
とjustify-content-center
のクラスを使用すると、それは望ましくありません!私はul
タグdisplay:flex
をブートストラップクラスを使用して作成しますが、その内容(li tags
)は水平方向と垂直方向の中央に揃えられていません。また、クロムのinspects
のul
プロパティをチェックしました。margin-top: 0
とmargin-bottom: value
です。何が問題ですか?ブートストラップ4の垂直方向の整列
HTML:
<body>
<div id="top-ribbon" class="container-fluid">
<div class="row align-items-center">
<div id="socials" class="col-6 col-md-2 offset-md-2">
<ul class="d-flex align-items-center justify-content-center">
<li class="list-inline-item color-white"><i">1</i></li>
<li class="list-inline-item color-white">2<i"></i></li>
</ul>
</div>
</div>
</div>
のCss:
color-white{
color: white;
}
#top-ribbon{
background-color: rgb(168, 8, 133);
border: 1px solid;
height: 200px;
}
.row{
height: 200px;
}
#top-ribbon div{
border: 1px solid;
}
#socials ul{
border: 1px solid;
}
おかげで、 "まず、あなたはHTML構文に問題を持っている" あなたは何を意味するのですか? – soheil
@soheil遅く返事を申し訳ありません。あなたのHTMLタグは次のようなものでした: ''それはちょうど ' ' –
ああ,,ありがとう:) – soheil