gpt4 book ai didi

html - 具有事件 li : how to hide the bottom on the ul when li is active 的 Flex Ul

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

我在 flex 中用 ulli 做一个标签。 The problem is that when the li is selected, the li bottom does not disappear even though I have made it transparent.

这是我的代码:

.scroll-nav-x {
white-space: nowrap;
overflow-x: scroll;
-ms-overflow-style: -ms-autohiding-scrollbar;
}

.scroll-nav-x::-webkit-scrollbar {
display: none;
}

.scroll-nav-x.scroll-tabs-x {
display: flex;
flex-direction: row;
overflow-y: hidden;
}

.scroll-nav-x.scroll-tabs-x li {
overflow: visible;
}

ul.tabs {
margin: 0;
padding: 0;
list-style: none;
height: 53px;
width: 100%;
border-bottom: 1px solid grey;
}

ul.tabs li {
float: left;
margin: 0;
cursor: pointer;
color: blue;
padding: 5px 30px;
line-height: 41px;
overflow: hidden;
position: relative;
text-transform: uppercase;
font-weight: 800;
letter-spacing: .9px;
margin: 0 0 -1px;
border-radius: 3px 3px 0 0;
display: block;
}

ul.tabs li:hover {
border: none;
}

ul.tabs li.active {
display: block;
color: black;
background-color: #fff;
border: 1px solid grey;
border-bottom-color: transparent;
cursor: default;
margin-bottom: 0;
}

.tab-container {
padding: 30px 0;
}

.tab-container.large {
padding: 30px;
border: 1px solid grey;
border-top: none;
}

.tab-container .col-md-4 {
padding-bottom: 10px;
}
<ul class="scroll-nav-x scroll-tabs-x tabs clearfix">
<li class="active" rel="tab1">All</li>
<li rel="tab2">Others</li>
</ul>

<div class="tab-container large">
<div id="tab1" class="tab-content" style="display: block;">
<div class="row">
Dummy
</div>
</div>
</div>

我应该如何设置列表底部,以便当 li 处于事件状态时,底部边框覆盖 ul 底部以在 ul< 之间创建无缝连接 和内容区域。谢谢。

最佳答案

您可以通过稍微调整 CSS 来实现此效果。

  1. li 添加一个底部边框,颜色与背景颜色相同(在本例中为#fff)
  2. 移除 ul
  3. 的底部边框
  4. 在选项卡容器的顶部添加边框,然后将其向上移动到选项卡列表下方。

这样选项卡将覆盖选项卡容器的顶部,使选项卡列表项看起来像是选项卡内容的一部分

.scroll-nav-x {
white-space: nowrap;
overflow-x: scroll;
-ms-overflow-style: -ms-autohiding-scrollbar;
}
.scroll-nav-x::-webkit-scrollbar {
display: none;
}
.scroll-nav-x.scroll-tabs-x {
display: flex;
flex-direction: row;
overflow-y: hidden;
}
.scroll-nav-x.scroll-tabs-x li {
overflow: visible;
}

ul.tabs {
margin: 0;
padding: 0;
list-style: none;
height: 53px;
width: 100%;
margin-bottom: -1px; /* Modified line */
}

ul.tabs li {
float: left;
margin: 0;
cursor: pointer;
color: blue;
padding: 5px 30px;
line-height: 41px;
overflow: hidden;
position: relative;
text-transform: uppercase;
font-weight: 800;
letter-spacing: .9px;
margin: 0 0 -1px;
border-radius: 3px 3px 0 0;
display: block;
}
ul.tabs li:hover{

border: none;

}
ul.tabs li.active {
display: block;
color: black;
background-color: #fff;
border: 1px solid grey;
border-bottom-color: #fff; /* Modified line */
cursor: default;
margin-bottom: 0;
}
.tab-container {
padding: 30px 0;
}
.tab-container.large {
padding: 30px;
border: 1px solid grey;
/* Removed line */
}
.tab-container .col-md-4 {
padding-bottom: 10px;
}
<ul class="scroll-nav-x scroll-tabs-x tabs clearfix">
<li class="active" rel="tab1">All</li>
<li rel="tab2">Others</li>
</ul>

<div class="tab-container large">
<div id="tab1" class="tab-content" style="display: block;">
<div class="row">
Dummy
</div>
</div>
</div>

关于html - 具有事件 li : how to hide the bottom on the ul when li is active 的 Flex Ul,我们在Stack Overflow上找到一个类似的问题: https://stackoverflow.com/questions/52472207/

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