伸缩项目未垂直居中

伸缩项目未垂直居中,第1张

伸缩项目未垂直居中

您的伸缩容器没有多余的高度。唯一的高度是内容的高度。因此,没有用于垂直居中的空间。

第一步,增加一些高度:

.row-centered {    display: flex;  height: 100vh;}

第二步,删除不必要的规则,其中一些规则会阻止垂直对齐。

.col-centered {    display: flex;    flex-direction: column;   }.row-centered {  display: flex;  height: 100vh;}.col-centered {  display: flex;  flex-direction: column;}.us-container {  display: flex;  justify-content: center;  align-items: center;}<link href="https://maxcdn.bootstrapcdn.com/bootstrap/3.3.7/css/bootstrap.min.css" rel="stylesheet" /><section id="us" >  <div >    <div >      <p >blah blah blah blah blah blahblah blah blahblah blah blahblah blah blahblah blah blahblah blah blahblah blah blahblah blah blahblah blah blahblah blah blahblah blah blahblah blah blahblah blah blahblah blah blahblah blah blahblah blah blahblah blah        blahblah blah blahblah blah blahblah blah blahblah blah blahblah blah blahblah blah blahblah blah blahblah blah blahblah blah blahblah blah blahblah blah blah</p>      <h3 >blah blah blah</h3>    </div>  </div></section>


欢迎分享,转载请注明来源:内存溢出

原文地址: http://outofmemory.cn/zaji/5629936.html

(0)
打赏 微信扫一扫 微信扫一扫 支付宝扫一扫 支付宝扫一扫
上一篇 2022-12-16
下一篇 2022-12-15

发表评论

登录后才能评论

评论列表(0条)

保存