我试图使两个相邻元素的内角在两个元素之间具有弯曲的边框效果,以隐藏90度角。当前设计的图片如下。
所需外观:
我已经反复搜索并阅读了许多文档,但似乎无法将其包裹在脑海中。我的CSS也不强。我目前在以下位置:
body {
overflow-x: hidden;
background-color: #111;
}
#right-sidebar {
z-index: 1000;
position: fixed;
top: 58px;
right: 0;
height: 100%;
width: 60px;
}
#right-sidebar .tab-group {
list-style: none;
padding: 0;
position: absolute;
width: 100%;
}
.tab-header {
opacity: 1;
color: #999;
text-align: center;
animation: fadeinout .3s linear both;
}
.tab .tab-header span {
display: none;
white-space: nowrap;
}
.tab .tab-header i {
display: initial;
}
.tab-header:hover {
color: goldenrod;
background: rgba(255, 255, 255, 0.2);
border-radius: inherit;
transition: all .3s ease-in-out;
}
.tab {
width: 60px;
border: goldenrod solid 1px;
border-right: 0;
border-radius: 8px 0 0 8px;
margin-bottom: 2px;
text-indent: 0;
line-height: 40px;
transition: all .3s ease-in-out .3s;
}
.tab.show {
width: 600px;
margin-left: -535px;
border-radius: 8px 0 0 0;
transition: all .3s ease-in-out;
}
.tab-body {
position: absolute;
visibility: hidden;
max-height: 300px;
width: 530px;
height: 0;
left: -535px;
border: goldenrod solid 1px;
border-top: 0;
border-radius: 0 0 8px 8px;
background: #111;
transition: all .3s ease-in-out;
}
.tab.show .tab-body {
height: 300px;
visibility: visible;
transition: all .3s ease-in-out .3s;
}
.tab.show .tab-header {
text-align: left;
padding-left: 12px;
}
.tab.show .tab-header span {
display: inline;
}
.tab.show .tab-header i {
display: none;
}
<body>
<div id="right-sidebar">
<ul class="tab-group">
<li class="tab show">
<div class="tab-header">
<span>Details</span>
<i>D</i>
</div>
<div class="tab-body"></div>
</li>
<li class="tab">
<div class="tab-header">
<span>Shortcuts</span>
<i>S</i>
</div>
<div class="tab-body"></div>
</li>
</ul>
</div>
</body>
下移的元素是tab-body(在右转向标志选项卡的旁边),而越过的元素(在右转向标志选项卡的上方)是'li
'元素
答案 0 :(得分:0)
我添加了.tab-body::before
,它有一个带有左上边框的小元素,没有背景,它的阴影覆盖了整个角度。它需要调整,但已经解决了很多:
body {
overflow-x: hidden;
background-color: #111;
}
#right-sidebar {
z-index: 1000;
position: fixed;
top: 58px;
right: 0;
height: 100%;
width: 60px;
}
#right-sidebar .tab-group {
list-style: none;
padding: 0;
position: absolute;
width: 100%;
}
.tab-header {
opacity: 1;
color: #999;
text-align: center;
animation: fadeinout .3s linear both;
}
.tab .tab-header span {
display: none;
white-space: nowrap;
}
.tab .tab-header i {
display: initial;
}
.tab-header:hover {
color: goldenrod;
background: rgba(255, 255, 255, 0.2);
border-radius: inherit;
transition: all .3s ease-in-out;
}
.tab {
width: 60px;
border: goldenrod solid 1px;
border-right: 0;
border-radius: 8px 0 0 8px;
margin-bottom: 2px;
text-indent: 0;
line-height: 40px;
transition: all .3s ease-in-out .3s;
}
.tab.show {
width: 600px;
margin-left: -535px;
border-radius: 8px 0 0 0;
transition: all .3s ease-in-out;
z-index: 999;
}
.tab-body {
position: absolute;
visibility: hidden;
max-height: 300px;
width: 530px;
left: -535px;
top: 39.5px;
border: goldenrod solid 1px;
border-top: 0;
border-radius: 0 0 8px 8px;
background: #111;
transition: all .3s ease-in-out;
}
.tab-body::before {
content: '';
position: absolute;
height: 13px;
width: 13px;
left: 100%;
top: 1px;
border: goldenrod solid 1px;
border-bottom: 0;
border-right: 0;
border-top-left-radius: 8px;
box-shadow: -4px -2px 0 0 #111;
}
.tab.show .tab-body {
height: 300px;
visibility: visible;
transition: all .3s ease-in-out .3s;
}
.tab.show .tab-header {
text-align: left;
padding-left: 12px;
}
.tab.show .tab-header span {
display: inline;
}
.tab.show .tab-header i {
display: none;
}
<body>
<div id="right-sidebar">
<ul class="tab-group">
<li class="tab show">
<div class="tab-header">
<span>Details</span>
<i class="fas fa-info">D</i>
</div>
<div class="tab-body"></div>
</li>
<li class="tab">
<div class="tab-header">
<span>Shortcuts</span>
<i class="fas fa-directions">S</i>
</div>
<div class="tab-body"></div>
</li>
</ul>
</div>
</body>