
原帖中提供的代码不能实现选中时有边框和背景色的效果。下面是用 html 实现这种效果的代码:
<!DOCTYPE html>
<html lang="en">
<head>
<meta charset="UTF-8">
<meta name="viewport" content="width=device-width, initial-scale=1.0">
<title>Document</title>
</head>
<body>
<div class="tabs">
<div class="tab active">日</div>
<div class="tab">周</div>
<div class="tab">月</div>
<div class="tab">年</div>
</div>
</body>
<style>
.tabs {
display: flex;
justify-content: space-between;
flex-direction: row;
background-color: #E1E1E1;
border-radius: 82px;
height: 82px;
}
.tab {
font-size: 36px;
color: rgba(69, 69, 68, 1);
width: 100%;
text-align: center;
line-height: 82px;
}
.tab.active {
color: rgba(255, 255, 255, 1);
background-color: #31BDEC;
border-radius: 82px;
}
</style>
</html>效果如下:
[图片]
以上就是Vue/UniApp 选项卡选中时如何添加边框和背景色?的详细内容,更多请关注php中文网其它相关文章!
每个人都需要一台速度更快、更稳定的 PC。随着时间的推移,垃圾文件、旧注册表数据和不必要的后台进程会占用资源并降低性能。幸运的是,许多工具可以让 Windows 保持平稳运行。
Copyright 2014-2025 https://www.php.cn/ All Rights Reserved | php.cn | 湘ICP备2023035733号