HTML5+CSS3+JS小实例:暗紫色Tabbar
<!DOCTYPE html>
<html lang="en">
<head>
<meta charset="UTF-8">
<meta name="viewport" content="width=device-width, initial-scale=1.0">
<title>暗紫色Tabbar示例</title>
<style>
body {
margin: 0;
padding: 0;
display: flex;
height: 100vh;
background-color: #28004d;
}
.tabbar-container {
display: flex;
justify-content: space-around;
align-items: center;
height: 80px;
background-color: #28004d;
position: fixed;
left: 0;
right: 0;
bottom: 0;
}
.tabbar-item {
display: flex;
flex-direction: column;
align-items: center;
justify-content: center;
width: 25%;
color: #666;
font-size: 1.5rem;
}
.tabbar-item.active {
color: #ff4d94;
}
.tabbar-item.active::before {
content: '';
position: absolute;
bottom: 0;
left: 0;
width: 100%;
height: 5px;
background-color: #ff4d94;
}
</style>
</head>
<body>
<div class="tabbar-container">
<div class="tabbar-item active">
首页
</div>
<div class="tabbar-item">
发现
</div>
<div class="tabbar-item">
我的
</div>
</div>
</body>
</html>
这段代码提供了一个暗紫色调的底部导航栏示例,其中包含了一个激活状态的tab,并使用CSS伪元素::before
来展示激活状态下的下划线。这个示例简单直观,方便理解和学习。
评论已关闭