我想要做到这一点:div的内容应该在每个屏幕大小的中心。但是,当我调整div的浏览器内容的大小时,div的内容就会超出父div的范围,而父div仍然处于中心位置。
我试图将宽度限制在特定的大小,但是内容会连接在一起。我也尝试给父母的div flex-wrap: wrap;,但它不会一点一点地中断,它只是变成块,我指的是对方。这是我的密码:
<div class="optionsPar d-flex">
<div class="options mx-auto">
<div class="row" style="width: inherit;">
<div class="d-flex">
<div class="col-md-2 col-sm-3 d-flex align-items-center mt-4">
<strong>.com</strong><span>$11.25</span>
</div>
<div class="col-md-2 col-sm-3 d-flex align-items-center mt-4">
<strong>.com</strong><span>$11.25</span>
</div>
<div class="col-md-2 col-sm-3 d-flex align-items-center mt-4">
<strong>.com</strong><span>$11.25</span>
</div>
<div class="col-md-2 col-sm-3 d-flex align-items-center mt-4">
<strong>.com</strong><span>$11.25</span>
</div>
<div class="col-md-2 col-sm-3 d-flex align-items-center mt-4">
<strong>.com</strong><span>$11.25</span>
</div>
<div class="col-md-2 col-sm-3 d-flex align-items-center mt-4">
<strong>.com</strong><span>$11.25</span>
</div>
</div>
</div>
</div>
</div>
我需要帮助,谢谢。
发布于 2022-08-17 15:34:30
您必须对类optionPra的主div使用框大小边框。
<style> .optionsPar{box-sizing: border-box; width: 100%;} </style>
https://stackoverflow.com/questions/73391090
复制相似问题