div+css模仿微信即时通讯聊天app的ui原型代码
代码语言:html
所属分类:布局界面
代码描述:div+css模仿微信即时通讯聊天app的ui原型代码
代码标签: div css 模仿 微信 即时 通讯 聊天 app ui 原型 代码
下面为部分代码预览,完整代码请点击下载或在bfwstudio webide中打开
<!DOCTYPE html>
<html lang="zh-CN">
<head>
<meta charset="UTF-8">
<meta name="viewport" content="width=device-width, initial-scale=1.0, maximum-scale=1.0, user-scalable=no">
<title>ChatApp - UI Prototype</title>
<link rel="preconnect" href="https://fonts.googleapis.com">
<link rel="preconnect" href="https://fonts.gstatic.com" crossorigin>
<link href="https://fonts.googleapis.com/css2?family=Poppins:wght@400;500;600&family=Noto+Sans+SC:wght@400;500;700&display=swap" rel="stylesheet">
<style>
/* --- 全局样式与变量 --- */
:root {
--primary-color: #07C160; /* 微信绿 */
--bg-color: #EDEDED;
--surface-color: #FFFFFF;
--header-bg-color: #F7F7F7;
--text-color: #1A1A1A;
--text-secondary-color: #8A8A8A;
--border-color: #D8D8D8;
--active-tap-color: #E5E5E5;
--chat-bubble-sent-bg: #95EC6A;
}
* {
margin: 0;
padding: 0;
box-sizing: border-box;
-webkit-tap-highlight-color: transparent;
}
html, body {
height: 100%;
overflow: hidden;
}
body {
font-family: 'Poppins', 'Noto Sans SC', sans-serif;
background-color: #000;
color: var(--text-color);
-webkit-font-smoothing: antialiased;
-moz-osx-font-smoothing: grayscale;
}
#app-container {
position: relative;
max-width: 420px;
height: 100%;
margin: 0 auto;
background-color: var(--bg-color);
overflow: hidden;
display: flex;
flex-direction: column;
box-shadow: 0 0 30px rgba(0,0,0,0.5);
}
/* --- 页面切换逻辑 --- */
.page {
position: absolute;
top: 0;
left: 0;
width: 100%;
height: 100%;
display: flex;
flex-direction: column;
background-color: var(--bg-color);
opacity: 0;
visibility: hidden;
transform: translateX(100%);
transition: transform 0.3s ease-in-out, opacity 0.3s ease-in-out;
z-index: 10;
}
.page.no-animation {
transform: translateX(0);
transition: none;
}
.page.active {
opacity: 1;
visibility: visible;
transform: translateX(0);
z-index: 20;
}
.page.moving-out {
transform: translateX(-30%);
}
/* --- 通用组件 --- */
.header {
flex-shrink: 0;
display: flex;
align-items: center;
justify-content: space-between;
padding: 10px 15px;
background-color: var(--header-bg-color);
border-bottom: 1px solid var(--border-color);
height: 56px;
}
.header-title {
font-size: 1.1rem;
font-weight: 600;
position: absolute;
left: 50%;
transform: translateX(-50%);
}
.header-actions .icon {
margin-left: 15px;
}
.back-btn {
width: 36px;
background: none; border: none; cursor: pointer; display: flex; align-items: center;
}
.back-btn .icon {
width: 28px; height: 28px;
}
.content {
flex-grow: 1;
overflow-y: auto;
background-color: var(--bg-color);
}
.list-item {
display: flex;
align-items: center;
padding: 10px 15px;
background-color: var(--surface-color);
cursor: pointer;
position: relative;
}
.list-item:not(:last-child)::after {
content: '';
position: absolute;
bottom: 0;
left: 70px; /* Avatar width + padding */
right: 0;
height: 1px;
background-color: var(--bg-color);
}
.list-item:active {
background-color: var(--active-tap-color);
}
.avatar {
width: 50px;
height: 50px;
border-radius: 8px;
object-fit: cover;
margin-right: 15px;
background-color: #eee;
}
.list-item-content {
flex: 1;
overflow: hidden;
}
.list-item-content h4 {
font-size: 1rem;
font-weight: 500;
white-space: nowrap;
overflow: hidden;
text-overflow: ellipsis;
}
.list-item-content p {
font-size: 0.85rem;
color: var(--text-secondary-color);
white-space: nowrap;
overflow: hidden;
text-overflow: ellipsis;
}
.list-item-meta {
text-align: right;
font-size: 0.75rem;
color: var(--text-secondary-color);
align-self: flex-start;
}
.unread-badge {
background-color: #FA5151;
color: white;
font-size: 0.7rem;
padding: 2px 6px;
border-radius: 10px;
margin-top: 5px;
display: inline-block;
}
.search-bar {
padding: 8px 15px;
background-color: var(--bg-color);
}
.search-input-wrapper {
background-color: var(--surface-color);
border-radius: 8px;
display: flex;
align-items: center;
justify-content: center;
padding: 8px;
}
.search-input-wrapper .icon {
width: 18px; height: 18px; color: var(--text-secondary-color); margin-right: 5px;
}
.search-input-wrapper span {
color: var(--text-secondary-color);
}
/* --- 底部导航栏 --- */
.bottom-nav {
flex-shrink: 0;
display: flex;
position: absolute;
bottom: 0;
width: 100%;
height: 60px;
background-color: var(--header-bg-color);
border-top: 1px solid var(--border-color);
z-index: 100;
}
.nav-item {
flex: 1;
display: flex;
flex-direction: column;
justify-content: center;
align-items: center;
color: var(--text-secondary-color);
cursor: pointer;
}
.nav-item.active { color: var(--primary-color); }
.nav-item .icon { width: 28px; height: 28px; margin-bottom: 2px; }
.nav-item span { font-size: 0.7rem; }
/* --- SVG图标 --- */
.icon {
stroke-width: 1.5;
fill: none;
stroke: currentColor;
s.........完整代码请登录后点击上方下载按钮下载查看
















网友评论0