gpt4 book ai didi

html - Bootstrap 圆模态

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

我正在尝试以圆形形式创建引导模式。已经创建了一个,但我的问题是如何响应式地将文本插入圆模态的中间?

<link rel="stylesheet" href="https://maxcdn.bootstrapcdn.com/bootstrap/3.3.7/css/bootstrap.min.css">
<script src="https://ajax.googleapis.com/ajax/libs/jquery/2.1.1/jquery.min.js"></script>
<script src="https://maxcdn.bootstrapcdn.com/bootstrap/3.3.7/js/bootstrap.min.js"></script>

<style>
.modal-content {
background-color: #0099FF;
position: relative;
border-radius: 50%;
width: 100%;
height: auto;
padding-top: 100%;
}
</style>


<button type="button" class="btn btn-primary btn-lg" data-toggle="modal" data-target="#myModal">
Modal
</button>

<div class="modal fade" id="myModal" tabindex="-1" role="dialog" aria-labelledby="myModalLabel">
<div class="modal-dialog" role="document">
<div class="modal-content">
</div>
</div>
</div>

最佳答案

Flex box 会帮助你,我已经删除了将内容推送到底部的 padding-top。对于高度,我使用了 height:100vwmax-height:600px 这将使盒子成为正确的圆形。

<link rel="stylesheet" href="https://maxcdn.bootstrapcdn.com/bootstrap/3.3.7/css/bootstrap.min.css">
<script src="https://ajax.googleapis.com/ajax/libs/jquery/2.1.1/jquery.min.js"></script>
<script src="https://maxcdn.bootstrapcdn.com/bootstrap/3.3.7/js/bootstrap.min.js"></script>


<style>
.modal-content {
background-color: #0099FF;
position: relative;
border-radius: 50%;
width: 100%;
height: 100vw;
display: flex;
justify-content: center;
align-items: center;
max-height: 600px;
}
</style>


<button type="button" class="btn btn-primary btn-lg" data-toggle="modal" data-target="#myModal">
Modal
</button>

<div class="modal fade" id="myModal" tabindex="-1" role="dialog" aria-labelledby="myModalLabel">
<div class="modal-dialog" role="document">
<div class="modal-content">
Content
</div>
</div>
</div>

关于html - Bootstrap 圆模态,我们在Stack Overflow上找到一个类似的问题: https://stackoverflow.com/questions/42082516/

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