html - 在 Bootstrap 中设置位置而不影响响应能力
问题描述
我是网页设计的菜鸟。我刚刚开始尝试使用 Bootstrap。我想添加两个 这样的按钮,
但是,我在移动设备上得到了这个
使用此代码:
<button style = "position:absolute; left:38%; top:50%; z-index=0" type="button" class="btn btn-primary btn-lg">Large button</button>
<button style = "position:absolute; left:53%; top:50%; z-index:0" type="button" class="btn btn-primary btn-lg">Large button</button>
我知道我不应该添加位置属性,因为它们会使响应无效,但不使用它们会放置这样的按钮。
那么我该怎么做呢?如何在不影响响应的情况下指定位置?
谢谢你!
解决方案
感谢@zgood 的评论,我已经解决了这个问题:
<div style="width:100vw; height: 100vh; display:flex; align-items: center; justify-content:center">
<button style="margin:20px" type="button" class="btn btn-primary btn-lg">Large button</button>
<button style="margin:20px" type="button" class="btn btn-primary btn-lg">Large button</button>
</div>
推荐阅读
- svelte - 如何预览单击 Svelte 中的图标(例如:附件图标)上传的图像?
- python - 在 PyCharm 中执行 Jupyter Notebook / Colab 指令
- react-native - React Native:持久化 API 数据并在连接时检查它是否是最新的
- r - 总结列并将其作为 R 中的 colnames- 数据框
- angular - Angular OnChanges 为输入变量触发,但变量未更新
- lvm - 缺少 LVM 卷的创建时间
- windows - 阻止用户使用 PowerShell 打开已经存在的程序
- azure - 您可以使用 sql server 别名使用活动目录集成身份验证连接到 azure 吗?
- r - rmd 子交叉引用
- python-3.x - 搜索引擎如何立即检测到我的爬虫