コンテンツを縦と横の中央に配置したいが、水平にのみセンタリングする。問題は、高さが固定されていないことです。 皆さん、助けてくれてありがとう!固定高さなしにDIVを水平および垂直にセンタリングする
html,
body {
height: 100% margin: 0;
overflow: hidden;
}
.content {
width: 100%;
height: 100%;
align-items: center;
justify-content: center;
display: flex;
flex-direction: column;
text-align: center;
}
<div class="content">
<h1>Welcome to the website!</h1>
</div>
ここであなたのhtmlは –
このスレッドでは答えが見つからないと肯定的ですか?http://stackoverflow.com/questions/396145/how-to-vertically-center-a-div-for-すべてのブラウザ? – Turnip
ありがとう、解決策を見つけました! – Daniel