gpt4 book ai didi

html - 我们如何在使用变换 css 定位的 div 之上显示一个 div

转载 作者:行者123 更新时间:2023-11-27 22:58:11 24 4
gpt4 key购买 nike

我们如何在使用 transform CSS 属性定位的 div 之上显示一个 div?我想始终在其他单元格之上显示处理程序。在下面的示例中,我总是想在任何其他 div 之上显示 ltHandler、rbHandler?我们可以使用 z-index 或任何其他方式覆盖(显示在顶部)CSS 变换定位元素与其他单元格吗?

   <!DOCTYPE html>
<html>
<head>
<title>Page Title</title>

<style>
.row {
position: absolute;
height: 28px;
}

.cell {
display: inline-block;
position: absolute;
width: 150px;
height: 150px;
color: red;
border: 1px solid black;
}

.left-top-handler,
.right-bottom-handler {
width: 20px;
height: 20px;
border-radius: 50%;
background-color: red;
position: absolute;
z-index: 999 !important;
cursor: nwse-resize;
touch-action: none;
}

.left-top-handler {
left: -10px;
top: -10px;
}

.right-bottom-handler {
right: -10px;
bottom: -10px;
}

#cell1 {
left: 0px;
}

#cell2 {
left: 150px;
}

#cell3 {
left: 300px;
}

#row2 {

transform: translateY(150px);
}

#row3 {

transform: translateY(300px);
}

#row3 .cell{
background-color:yellow;

}
</style>
</head>
<body>



<div id="row1" class="row">
<div id="cell1" class="cell">
<div>fjsdjkfgjk</div>
</div>
<div id="cell2" class="cell">
<div>fjsdjkfgjk</div>
</div>

<div id="cell3" class="cell">
<div>fjsdjkfgjk</div>
</div>
</div>

<div id="row2" class="row">
<div id="cell1" class="cell">
<div>fjsdjkfgjk</div>
</div>
<div id="cell2" class="cell">
<div>fjsdjkfgjk</div>
<div id="ltHandler" class='left-top-handler handler'></div>
<div id="rbHandler" class='right-bottom-handler handler'></div>
</div>

<div id="cell3" class="cell">
<div>fjsdjkfgjk</div>
</div>
</div>


<div id="row3" class="row">
<div id="cell1" class="cell">
<div>row3 cell1</div>
</div>
<div id="cell2" class="cell">
<div>row3 cell2</div>
</div>

<div id="cell3" class="cell">
<div>row3 cell3</div>
</div>
</div>


</body>
</html>

最佳答案

像这样将row3 z-index设置为-1

#row3 {
transform: translateY(300px);
z-index: -1;
}

关于html - 我们如何在使用变换 css 定位的 div 之上显示一个 div,我们在Stack Overflow上找到一个类似的问题: https://stackoverflow.com/questions/59137189/

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