gpt4 book ai didi

html - 如何使用 Bootstrap 堆叠 div 层?

转载 作者:行者123 更新时间:2023-11-28 04:46:44 25 4
gpt4 key购买 nike

我想实现以下目标: layered div

行正在工作,但我无法将顶层 div(带有类映射的那个)放在正确的位置,它总是将一些行推到一边。如何使用 bootstrap 获得预期的结果?

/*  my css: (index.css) */
.container-full {
margin: 0 auto;
width: 90%;
margin-bottom: 100px;
}

.blue-row{
height: 200px;
background: linear-gradient(#4b7fe4, #99B4E8)
}
.grey-row{
background-color: #e3e3e3;
}

.darkgrey-row{
height: 100px;
background-color: #bebebe;
}

.map{
height: 200px;
width: 200px;
position: relative;
z-index:9999;
background:red;
}
<div class="container container-full" ng-app="myApp" ng-controller="myCtrl">
<div class="row blue-row">
asas
</div>
<div class="row grey-row">
<div class="map"> <!-- top layer div -->
content
</div>
</div>
<div class="row darkgrey-row">asasas</div>

最佳答案

是这样的吗?

.container-full {
margin: 0 auto;
width: 90%;
margin-bottom: 100px;
position:relative;
}

.blue-row{
height: 200px;
background: linear-gradient(#4b7fe4, #99B4E8)
}
.grey-row{
background-color: #e3e3e3;
}

.darkgrey-row{
height: 100px;
background-color: #bebebe;
}

.map{
height: 200px;
width: 200px;
position: absolute;
background:red;
top:50%;
left:50%;
z-index:9999;
transform:translate(-50%,-50%);
}
<div class="container container-full" ng-app="myApp" ng-controller="myCtrl">
<div class="row blue-row">
asas
</div>
<div class="row grey-row">
<div class="map"> <!-- top layer div -->
content
</div>
</div>
<div class="row darkgrey-row">asasas</div>

关于html - 如何使用 Bootstrap 堆叠 div 层?,我们在Stack Overflow上找到一个类似的问题: https://stackoverflow.com/questions/40919947/

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