聊天页面样式
代码:
<!DOCTYPE html>
<html lang="en">
<head>
<meta charset="UTF-8" />
<meta name="viewport" content="width=device-width, initial-scale=1.0" />
<link rel="stylesheet" href="./bootstrap-icons/font/bootstrap-icons.css" />
<title>Document</title>
<style>
* {
margin: 0px;
padding: 0px;
}
.container {
width: 100vw;
height: 100vh;
background-color: #6d6767;
display: flex;
justify-content: center;
align-items: center;
}
.chat-box {
width: 60%;
height: 70%;
background-color: #f8f8f8;
display: flex;
}
.left-box {
width: 50px;
background-color: #2e2e2e;
}
.right-box {
flex: 1;
background-color: #f7f7f7;
display: flex;
}
.main-box {
flex: 7;
display: flex;
flex-direction: column;
justify-content: space-between;
}
.menu-box {
flex: 3;
display: flex;
flex-direction: column;
border-right: 1px solid #d6d6d6;
}
.menu-top {
height: 60px;
box-sizing: border-box;
position: relative;
}
.search-box {
display: flex;
width: 95%;
height: 20px;
justify-content: space-between;
padding: 4px 5px;
align-items: center;
position: absolute;
bottom: 10px;
}
.search-box input {
line-height: 20px;
width: 70%;
border: 0px;
outline: none;
background: transparent;
}
.search-box i {
padding: 0px;
background-color: #d1d1d1;
border-radius: 2px;
font-size: 15px;
}
.search {
display: flex;
align-items: center;
justify-content: center;
background-color: #d1d1d1;
width: 85%;
position: relative;
border-radius: 3px;
}
.search i {
font-size: 12px;
position: absolute;
left: 5px;
}
.menu-content {
flex: 1;
background-color: #d3d1d0;
height: 100%;
overflow: hidden;
}
.menu-list::-webkit-scrollbar {
width: 1px;
}
.menu-list {
display: flex;
flex-direction: column;
height: 100%;
overflow-x: hidden;
}
.menu-item {
display: flex;
justify-content: center;
height: 60px;
width: 100%;
margin: 5px;
}
.menu-left img {
width: 100%;
height: 100%;
}
.menu-right {
flex: 1;
display: flex;
flex-direction: column;
}
.menu-right .menu-date {
font-size: 12px;
color: #6d6767;
}
.menu-right-msg {
margin-bottom: 5px;
margin-left: 8px;
font-size: 12px;
color: #6d6767;
}
.menu-right-top {
display: flex;
justify-content: space-between;
align-items: center;
margin: auto 10px;
font-size: 15px;
}
.main-top {
height: 60px;
border-bottom: 1px solid #d3d1d0;
display: flex;
align-items: center;
font-size: 28px;
padding-left: 5px;
}
.main-content {
flex: 6;
border-bottom: 1px solid #d3d1d0;
overflow-y: auto;
}
.main-content::-webkit-scrollbar {
width: 1px;
}
.main-left {
display: flex;
margin: 15px auto;
}
.main-left img {
width: 30px;
height: 30px;
}
.main-left .main-msg {
margin-left: 10px;
background-color: #ffffff;
line-height: 30px;
max-width: 250px;
font-size: 15px;
letter-spacing: 5px;
}
.main-right {
display: flex;
width: 100%;
flex-direction: row-reverse;
margin: 15px auto;
}
.main-right img {
width: 30px;
height: 30px;
}
.main-right .main-msg {
margin-right: 10px;
background-color: #89d961;
line-height: 30px;
max-width: 250px;
font-size: 15px;
letter-spacing: 5px;
}
.main-input {
flex: 3;
display: flex;
flex-direction: column;
}
.main-input-top {
height: 30px;
display: flex;
justify-content: space-between;
padding: 5px 10px;
}
.main-input-top i{
margin: auto 5px;
}
.main-input-content {
flex: 1;
}
.main-input-send {
height: 50px;
display: flex;
align-items: center;
flex-direction: row-reverse;
padding-right: 20px;
}
.main-input-send a {
font-size: 15px;
background: #e9e9e9;
color: #07c160;
width: 80px;
height: 30px;
border-radius: 2px;
text-decoration: none;
cursor: pointer;
text-align: center;
line-height: 30px;
}
.btn1:hover{
background: #89d961;
}
.main-input-content textarea{
background: transparent;
width: 100%;
border: 0px;
outline: none;
height: 100%;
}
</style>
</head>
<body>
<div class="container">
<div class="chat-box">
<div class="left-box"></div>
<div class="right-box">
<div class="menu-box">
<div class="menu-top">
<div class="search-box">
<div class="search">
<i class="bi bi-search"></i>
<input type="text" placeholder="搜索" />
</div>
<i class="bi bi-plus-lg"></i>
</div>
</div>
<div class="menu-content">
<div class="menu-list">
<div class="menu-item">
<div class="menu-left">
<img src="./assets/head.png" alt="" srcset="" />
</div>
<div class="menu-right">
<div class="menu-right-top">
<div class="menu-title">张三</div>
<div class="menu-date">24/6/10</div>
</div>
<div class="menu-right-msg">没有其他的了</div>
</div>
</div>
<div class="menu-item">
<div class="menu-left">
<img src="./assets/head.png" alt="" srcset="" />
</div>
<div class="menu-right">
<div class="menu-right-top">
<div class="menu-title">张三</div>
<div class="menu-date">24/6/10</div>
</div>
<div class="menu-right-msg">没有其他的了</div>
</div>
</div>
<div class="menu-item">
<div class="menu-left">
<img src="./assets/head.png" alt="" srcset="" />
</div>
<div class="menu-right">
<div class="menu-right-top">
<div class="menu-title">张三</div>
<div class="menu-date">24/6/10</div>
</div>
<div class="menu-right-msg">没有其他的了</div>
</div>
</div>
<div class="menu-item">
<div class="menu-left">
<img src="./assets/head.png" alt="" srcset="" />
</div>
<div class="menu-right">
<div class="menu-right-top">
<div class="menu-title">张三</div>
<div class="menu-date">24/6/10</div>
</div>
<div class="menu-right-msg">没有其他的了</div>
</div>
</div>
<div class="menu-item">
<div class="menu-left">
<img src="./assets/head.png" alt="" srcset="" />
</div>
<div class="menu-right">
<div class="menu-right-top">
<div class="menu-title">张三</div>
<div class="menu-date">24/6/10</div>
</div>
<div class="menu-right-msg">没有其他的了</div>
</div>
</div>
<div class="menu-item">
<div class="menu-left">
<img src="./assets/head.png" alt="" srcset="" />
</div>
<div class="menu-right">
<div class="menu-right-top">
<div class="menu-title">张三</div>
<div class="menu-date">24/6/10</div>
</div>
<div class="menu-right-msg">没有其他的了</div>
</div>
</div>
<div class="menu-item">
<div class="menu-left">
<img src="./assets/head.png" alt="" srcset="" />
</div>
<div class="menu-right">
<div class="menu-right-top">
<div class="menu-title">张三</div>
<div class="menu-date">24/6/10</div>
</div>
<div class="menu-right-msg">没有其他的了</div>
</div>
</div>
<div class="menu-item">
<div class="menu-left">
<img src="./assets/head.png" alt="" srcset="" />
</div>
<div class="menu-right">
<div class="menu-right-top">
<div class="menu-title">张三</div>
<div class="menu-date">24/6/10</div>
</div>
<div class="menu-right-msg">没有其他的了</div>
</div>
</div>
<div class="menu-item">
<div class="menu-left">
<img src="./assets/head.png" alt="" srcset="" />
</div>
<div class="menu-right">
<div class="menu-right-top">
<div class="menu-title">张三</div>
<div class="menu-date">24/6/10</div>
</div>
<div class="menu-right-msg">没有其他的了</div>
</div>
</div>
<div class="menu-item">
<div class="menu-left">
<img src="./assets/head.png" alt="" srcset="" />
</div>
<div class="menu-right">
<div class="menu-right-top">
<div class="menu-title">张三</div>
<div class="menu-date">24/6/10</div>
</div>
<div class="menu-right-msg">没有其他的了</div>
</div>
</div>
<div class="menu-item">
<div class="menu-left">
<img src="./assets/head.png" alt="" srcset="" />
</div>
<div class="menu-right">
<div class="menu-right-top">
<div class="menu-title">张三</div>
<div class="menu-date">24/6/10</div>
</div>
<div class="menu-right-msg">没有其他的了</div>
</div>
</div>
<div class="menu-item">
<div class="menu-left">
<img src="./assets/head.png" alt="" srcset="" />
</div>
<div class="menu-right">
<div class="menu-right-top">
<div class="menu-title">张三</div>
<div class="menu-date">24/6/10</div>
</div>
<div class="menu-right-msg">没有其他的了</div>
</div>
</div>
<div class="menu-item">
<div class="menu-left">
<img src="./assets/head.png" alt="" srcset="" />
</div>
<div class="menu-right">
<div class="menu-right-top">
<div class="menu-title">张三</div>
<div class="menu-date">24/6/10</div>
</div>
<div class="menu-right-msg">没有其他的了</div>
</div>
</div>
<div class="menu-item">
<div class="menu-left">
<img src="./assets/head.png" alt="" srcset="" />
</div>
<div class="menu-right">
<div class="menu-right-top">
<div class="menu-title">张三</div>
<div class="menu-date">24/6/10</div>
</div>
<div class="menu-right-msg">没有其他的了</div>
</div>
</div>
</div>
</div>
</div>
<div class="main-box">
<div class="main-top">
<div class="main-top title">张三</div>
</div>
<div class="main-content">
<div class="main-left">
<img src="./assets/head.png" alt="" />
<div class="main-msg">比如一开始就它显示</div>
</div>
<div class="main-right">
<img src="./assets/head.png" alt="" />
<div class="main-msg">
当块级内容区域超出块级元素范围的时候,就会以滚动条的形式展示,你可以滚动里面的内容,里面的内容不会超出块级区域范围。
有时候我们需要自定义滚动条的样式
</div>
</div>
<div class="main-right">
<img src="./assets/head.png" alt="" />
<div class="main-msg">web中文字和div常用的居中方法</div>
</div>
</div>
<div class="main-input">
<div class="main-input-top">
<div class="main-input-top-left">
<i class="bi bi-emoji-smile"></i>
<i class="bi bi-folder2"></i>
<i class="bi bi-scissors"></i>
<i class="bi bi-chat-dots"></i>
</div>
<div class="main-input-top-right">
<i class="bi bi-telephone"></i>
<i class="bi bi-camera-video"></i>
</div>
</div>
<div class="main-input-content">
<textarea></textarea>
</div>
<div class="main-input-send">
<a class="btn1">发送(S)</a>
</div>
</div>
</div>
</div>
</div>
</div>
</body>
</html>