92 lines
2.1 KiB
HTML
92 lines
2.1 KiB
HTML
<!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, html {
|
|
margin: 0;
|
|
padding: 0;
|
|
height: 100%;
|
|
font-family: Arial, sans-serif;
|
|
background:red; /* 浅灰渐变背景 */
|
|
display: flex;
|
|
flex-direction: column;
|
|
justify-content: flex-end; /* TabBar 固定底部 */
|
|
}
|
|
|
|
.content {
|
|
flex: 1;
|
|
padding: 20px;
|
|
}
|
|
|
|
.tabbar {
|
|
display: flex;
|
|
justify-content: space-around;
|
|
align-items: center;
|
|
height: 70px;
|
|
backdrop-filter: blur(12px); /* 毛玻璃效果 */
|
|
-webkit-backdrop-filter: blur(12px);
|
|
background-color: rgba(255, 255, 255, 0.4); /* 半透明叠加色,让白色背景可见毛玻璃 */
|
|
border-top: 1px solid rgba(200, 200, 200, 0.3);
|
|
border-radius: 20px 20px 0 0;
|
|
padding-bottom: 10px;
|
|
padding-top: 10px;
|
|
}
|
|
|
|
.tabbar-item {
|
|
display: flex;
|
|
flex-direction: column;
|
|
align-items: center;
|
|
justify-content: center;
|
|
color: #333;
|
|
font-size: 12px;
|
|
text-decoration: none;
|
|
}
|
|
|
|
.tabbar-item.active {
|
|
color: #007aff;
|
|
}
|
|
|
|
/* 图标示例,用圆圈代替 */
|
|
.icon {
|
|
width: 24px;
|
|
height: 24px;
|
|
border-radius: 50%;
|
|
background-color: currentColor;
|
|
margin-bottom: 4px;
|
|
}
|
|
</style>
|
|
</head>
|
|
<body>
|
|
<div class="content">
|
|
<p>这里是页面内容,TabBar 放在底部。</p>
|
|
<p>背景是浅灰渐变,所以毛玻璃效果会明显。</p>
|
|
</div>
|
|
|
|
<div class="tabbar">
|
|
<a href="#" class="tabbar-item active">
|
|
<div class="icon"></div>
|
|
Finance
|
|
</a>
|
|
<a href="#" class="tabbar-item">
|
|
<div class="icon"></div>
|
|
Dating
|
|
</a>
|
|
<a href="#" class="tabbar-item">
|
|
<div class="icon"></div>
|
|
App
|
|
</a>
|
|
<a href="#" class="tabbar-item">
|
|
<div class="icon"></div>
|
|
Chat
|
|
</a>
|
|
<a href="#" class="tabbar-item">
|
|
<div class="icon"></div>
|
|
Profile
|
|
</a>
|
|
</div>
|
|
</body>
|
|
</html>
|