gpt4 book ai didi

css - 从表中删除元素

转载 作者:行者123 更新时间:2023-11-28 05:49:36 28 4
gpt4 key购买 nike

有人可以帮我用 block 元素拟合三 Angular 形吗?当用指针指定菜单元素时,如何删除上面不必要的新行?有人可以帮我用 block 元素拟合三 Angular 形吗?当用指针指定菜单元素时,如何删除上面不必要的新行?

代码 https://jsfiddle.net/fxdruwxf/

body{
width: 400px;
margin:0 auto;
}


#navtable{
position: relative;

width: 238px;
height: 900px;

border-radius: 6px;
border: 1px solid grey;
background: white;
}


.elem{
color: dodgerblue;
font-weight: bold;
padding: 10px 0px;
}

.elem:last-child{
line-height: 18px;
font-size: 10px
}
.elem:hover{
background-color: #C20009;
color: white;
border-top-right-radius: 5px;
border-bottom-right-radius: 5px;
}

.elem:hover .tr {
height:40px;
width:40px;
overflow:hidden;
transform:scale(1,1.2);/* increase visual height */
position: relative;
left: -40px;
bottom: -30px;
}
.tr::before{
float: left;
content:"";
width:70%;
height:70%;
float:right;
background:#C20009;
transform:rotate(-45deg);
box-shadow: 0 0 1px, inset 0 1px 1px , inset 5px -5px 5px rgba(0,0,0,0.3);
transform-origin: top right;
border-radius : 8px 0 0 0 /* and the rounded corner to finish */
}
<div id="navtable"> 
<br>
<div class="elem"><div class="tr"></div>Polecamy</div>
<div class="elem"><div class="tr"></div>Promocja</div>
<div class="elem"><div class="tr"></div>Nowości</div>
<div class="elem"><div class="tr"></div>Wypróbuj</div>

<br>
<div class="elem"><div class="tr"></div>Wszystkie</div>
</div>

最佳答案

考虑让你的 tr 类绝对定位,而你包含的 elem 元素相对定位:

.elem:hover{
background-color: #C20009;
color: white;
border-top-right-radius: 5px;
border-bottom-right-radius: 5px;
/* This will cause any child elements to be positioned relative to it */
position: relative;
}

.elem:hover .tr {
height:40px;
width:40px;
overflow:hidden;
transform:scale(1,1.2);/* increase visual height */
/* This will be positioned absolutely to it's container (which is relative) */
position: absolute;
left: -40px;
/* Since this is absolutely positioned, you'll want it to appear at the top */
top: 0px;
}

这应该大致为您提供您正在寻找的效果,如下例所示。

示例

enter image description here

body {
width: 400px;
margin: 0 auto;
}
#navtable {
position: relative;
width: 238px;
height: 900px;
border-radius: 6px;
border: 1px solid grey;
background: white;
}
.elem {
color: dodgerblue;
font-weight: bold;
padding: 10px 0px;
}
.elem:last-child {
line-height: 18px;
font-size: 10px
}
.elem:hover {
background-color: #C20009;
color: white;
border-top-right-radius: 5px;
border-bottom-right-radius: 5px;
position: relative;
}
.elem:hover .tr {
height: 40px;
width: 40px;
overflow: hidden;
transform: scale(1, 1.2);
/* increase visual height */
position: absolute;
left: -40px;
top: 0px;
}
.tr::before {
float: left;
content: "";
width: 70%;
height: 70%;
float: right;
background: #C20009;
transform: rotate(-45deg);
box-shadow: 0 0 1px, inset 0 1px 1px, inset 5px -5px 5px rgba(0, 0, 0, 0.3);
transform-origin: top right;
border-radius: 8px 0 0 0
/* and the rounded corner to finish */
}
<div id="navtable">
<br>
<div class="elem">
<div class="tr"></div>Polecamy</div>
<div class="elem">
<div class="tr"></div>Promocja</div>
<div class="elem">
<div class="tr"></div>Nowości</div>
<div class="elem">
<div class="tr"></div>Wypróbuj</div>

<br>
<div class="elem">
<div class="tr"></div>Wszystkie</div>
</div>

关于css - 从表中删除元素,我们在Stack Overflow上找到一个类似的问题: https://stackoverflow.com/questions/37419479/

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