我有一个水平居中的 HTML,其中包含一堆<p>
标签。当居中的 div 高度超出页面高度时,它会缩进 div。我该如何阻止这种情况发生?
.container {
display: flex;
justify-content: center;
}
.center {
width: 600px;
max-width: 600px;
border-left: 1px;
border-right: 1px;
border-top: 1px;
border-bottom: 1px;
border-color: rgb(0, 0, 0);
border-style: solid;
}
<div class="container">
<div class="center">
<p>test</p>
<p>test</p>
<p>test</p>
<p>test</p>
<p>test</p>
<p>test</p>
<p>test</p>
<p>test</p>
<p>test</p>
<p>test</p>
<p>test</p>
<p>test</p>
<p>test</p>
<p>test</p>
<p>test</p>
<p>test</p>
<p>test</p>
<p>test</p>
<p>test</p>
<p>test</p>
</div>
</div>
我尝试将中心 div 中的溢出设置为“自动”。但这没有用。