html - 缩小网站时不让按钮和 div 相互进入
问题描述
我试图对其进行大量研究,但找不到任何有用的东西:
我的网站正在构建,中间有一个框,下面是一个按钮。我注意到,如果我缩小网站的高度,按钮就会位于框下方。我怎样才能让它响应?非常感谢您,如果已经有这样的问题,我们很抱歉。
.bg-text {
border: 3px inset #f1f1f1;
position: absolute;
top: 38%;
left: 50%;
transform: translate(-50%, -50%);
z-index: 2;
width: 80%;
padding: 20px;
text-align: center;
}
.btn {
position: absolute;
top: 70%;
left: 38%;
transform: translate(-50%, -50%);
-ms-transform: translate(-50%, -50%);
cursor: pointer;
}
<div class="bg-text">
<h1>h1</h1>
<p>p</p>
</div>
<button type="button" class="btn btn-outline-light">About</button>
解决方案
开始了:
.bg-text {
border: 3px inset #f1f1f1;
margin: 20px auto;
z-index: 2;
width: 80%;
padding: 20px;
text-align: center;
}
.btn {
display: block;
margin: 0 auto;
cursor: pointer;
}
推荐阅读
- java - 将一个数组中的数据传输到两个数组的方法?
- mysql - 游标选择的 MySQL 存储过程语法错误
- ios - Mac Catalyst for Mac 菜单栏中的 NSPopover
- pyspark - 如何将字符串转换为日期格式 ddmonyyyy
- terraform - Terraform 配置器触发器仅适用于新实例/仅运行一次
- google-sheets - 如何为 Google 表格生成 Zoho-oauthtoken
- json - 可能有两种形式的对象的 Json 模式验证
- java - pom中spring-boot-maven-plugin中的exec分类器-pod启动错误-Openshift
- c# - 使用 128 条码时如何获取 WPF KeyDown 事件以捕获 Enter 键?
- svcutil.exe - Svcutil --update 错误输出没有意义