gpt4 book ai didi

css - 使用 Bootstrap Modal 4.3 垂直对齐中心

转载 作者:太空宇宙 更新时间:2023-11-04 00:55:45 25 4
gpt4 key购买 nike

我正尝试在主体中的模态中心垂直对齐,但没有任何反应。怎么了?我使用 4.3 版的 Bootstrap 。!

<section>
<div id="search-shopkeeper-modal" class="modal fade" tabindex="-1" role="dialog" aria-labelledby="shopkeeperModal" aria-hidden="true">
<div class="modal-dialog modal-xl" role="document">
<div class="modal-content">
<div class="modal-header border-0 p-0 m-0">
<div class="container-fluid p-2">
<form action="">
<div class="form-row">
<div class="col-12">
<div class="input-group input-group-lg">
<div class="input-group-prepend">
<span id="search-shopkeeper-addon" class="input-group-text bg-transparent border-0"><i class="fas fa-search"></i></span>
</div>
<input type="text" class="form-control rounded-0 border-0 shadow-none" placeholder="Digite o nome do Lojista..." aria-label="Username" aria-describedby="search-shopkeeper-addon">
</div>
</div>
</div>
</form>
</div>
</div>
<div class="modal-body" style="border: 1px red solid">
<!-- @todo -->
<div class="container d-flex align-items-center" style="border: 1px red solid">
<div><h1 class="text-center">SEM RESULTADOS!</h1></div>
</div>
</div>
<div class="modal-footer">
<button type="button" class="btn btn-default text-white shadow-none" data-dismiss="modal" style="background-color: #333333 !important">Fechar</button>
</div>
</div>
</div>
</div>
</section>

enter image description here

最佳答案

您要添加以下规则:

.modal-body {
display: flex;
align-items: center;
justify-content: center;
}

这可以从以下方面看出:

.modal-content {
height: 500px; /* Needed for this example to demonstrate the change */
}

.modal-body {
display: flex;
align-items: center;
justify-content: center;
}
<link rel="stylesheet" href="https://maxcdn.bootstrapcdn.com/bootstrap/4.0.0/css/bootstrap.min.css" integrity="sha384-Gn5384xqQ1aoWXA+058RXPxPg6fy4IWvTNh0E263XmFcJlSAwiGgFAW/dAiS6JXm" crossorigin="anonymous">
<script src="https://code.jquery.com/jquery-3.2.1.slim.min.js" integrity="sha384-KJ3o2DKtIkvYIK3UENzmM7KCkRr/rE9/Qpg6aAZGJwFDMVNA/GpGFF93hXpG5KkN" crossorigin="anonymous"></script>
<script src="https://cdnjs.cloudflare.com/ajax/libs/popper.js/1.12.9/umd/popper.min.js" integrity="sha384-ApNbgh9B+Y1QKtv3Rn7W3mgPxhU9K/ScQsAP7hUibX39j7fakFPskvXusvfa0b4Q" crossorigin="anonymous"></script>
<script src="https://maxcdn.bootstrapcdn.com/bootstrap/4.0.0/js/bootstrap.min.js" integrity="sha384-JZR6Spejh4U02d8jOt6vLEHfe/JQGiRRSQQxSfFWpi1MquVdAyjUar5+76PVCmYl" crossorigin="anonymous"></script>

<section>
<div id="search-shopkeeper-modal" class="" tabindex="-1" role="dialog" aria-labelledby="shopkeeperModal" aria-hidden="true">
<div class="modal-dialog modal-xl" role="document">
<div class="modal-content">
<div class="modal-header border-0 p-0 m-0">
<div class="container-fluid p-2">
<form action="">
<div class="form-row">
<div class="col-12">
<div class="input-group input-group-lg">
<div class="input-group-prepend">
<span id="search-shopkeeper-addon" class="input-group-text bg-transparent border-0"><i class="fas fa-search"></i></span>
</div>
<input type="text" class="form-control rounded-0 border-0 shadow-none" placeholder="Digite o nome do Lojista..." aria-label="Username" aria-describedby="search-shopkeeper-addon">
</div>
</div>
</div>
</form>
</div>
</div>
<div class="modal-body" style="border: 1px red solid">
<!-- @todo -->
<div class="container d-flex align-items-center" style="border: 1px red solid">
<div>
<h1 class="text-center">SEM RESULTADOS!</h1>
</div>
</div>
</div>
<div class="modal-footer">
<button type="button" class="btn btn-default text-white shadow-none" data-dismiss="modal" style="background-color: #333333 !important">Fechar</button>
</div>
</div>
</div>
</div>
</section>

关于css - 使用 Bootstrap Modal 4.3 垂直对齐中心,我们在Stack Overflow上找到一个类似的问题: https://stackoverflow.com/questions/54794472/

25 4 0
Copyright 2021 - 2024 cfsdn All Rights Reserved 蜀ICP备2022000587号
广告合作:1813099741@qq.com 6ren.com