html - CSS中带有以下线条的自定义选项卡
问题描述
我正在设计一个应用程序,其中我希望有如下标签
但目前我看到如下内容(由框覆盖)
我在网上搜索了类似的设计,但没有找到任何东西。你能帮助实现同样的目标吗?
更新
我可以得到border-bottom: 2px solid blue;
下面的蓝线,但突出显示的框仍然出现,如下所示。我也想避免这种情况。
解决方案
.tabs {
position: relative;
min-height: 200px; /* This part sucks */
clear: both;
margin: 45px 0 25px;
background: white;
color: #41C0ED;
font-weight:bold;
padding: 5px;
}
.tab {
float: left;
}
.tab label {
background: #fff;
padding: 10px;
border-bottom: 1px solid #ccc;
margin-left: -1px;
position: relative;
left: 1px;
top: -29px;
}
.tab [type=radio] {
display: none;
}
.content {
position: absolute;
top: -1px;
left: 0;
background: white;
right: 0;
bottom: 0;
padding: 20px;
border-top: 1px solid #ccc;
-webkit-transition: opacity .6s linear;
opacity: 0;
}
[type=radio]:checked ~ label {
border-bottom: 2px solid #308AC2;
z-index: 2;
padding-bottom: 4px;
}
[type=radio]:checked ~ label ~ .content {
z-index: 1;
opacity: 1;
}
<div class="tabs">
<div class="tab">
<input type="radio" id="tab-1" name="tab-group-1" checked>
<label for="tab-1">Tab One</label>
<div class="content">
</div>
</div>
<div class="tab">
<input type="radio" id="tab-2" name="tab-group-1">
<label for="tab-2">Tab Two</label>
<div class="content">
</div>
</div>
<div class="tab">
<input type="radio" id="tab-3" name="tab-group-1">
<label for="tab-3">Tab Three</label>
<div class="content">
</div>
</div>
</div>
推荐阅读
- graphql - GraphQL 如何使用 UseSubscription 钩子读取值
- java - 如何获取类型注释的值
- r - 尝试解析数据并在 R 中查找多个重复值时出错
- google-cloud-platform - 在 GCS 和 Cloud Shell 之间下载和上传文件和文件夹
- mysql - 如何在 SQL 中实现以下结果?
- r - 读取 csv 时出错(从 zip 文件中提取时出错 1 文件中的错误(con,“r”):无效的“描述”参数),但所有文件都已关闭
- python - 如何更改Windows电脑的桌面背景?
- python - Python字典理解范围
- c# - 实例与继承
- amazon-web-services - 当我在 AWS 策略模拟器中明确允许 S3 IAM 用户操作时,“隐式拒绝”