移动聊天UI实现

<!DOCTYPE html>
<html lang="en">

<head>
    <meta charset="UTF-8">
    <meta name="viewport" content="width=device-width, initial-scale=1.0">
    <meta http-equiv="X-UA-Compatible" content="ie=edge" />
    <title>Document</title>
    <style>
        body {
            font-family: "PingFang SC", sans-serif;
        }
        
        * {
            box-sizing: border-box;
        }
        
        ul,
        li {
            margin: 0;
            padding: 0;
        }
        
        .container {
            display: flex;
            align-items: center;
            justify-content: center;
        }
        
        .page {
            width: 375px;
            height: 812px;
            box-shadow: 0px 4px 16px rgba(0, 0, 0, 0.1);
            margin: 48px 0;
        }
        /* 背景 */
        
        .main-panel {
            background: #0061c4;
            max-height: 100%;
            display: flex;
            flex-direction: column;
        }
        /* 导航 */
        
        nav {
            padding: 48px 24px 30px 24px;
        }
        
        .buttons {
            display: flex;
            justify-content: space-between;
            color: white;
        }
        
        .menu {
            display: flex;
            justify-content: space-between;
        }
        
        .menu li {
            list-style: none;
            color: rgba(255, 255, 255, 0.68);
            font-size: 18px;
            margin-top: 48px;
        }
        
        .menu .active {
            color: white
        }
        /* 常用联系人 */
        
        .middle-panel {
            background: #f2f8fc;
            border-radius: 34rpx;
            padding: 30px 24px 100px 24px;
            margin-bottom: -80px;
        }
        
        .favorite-menu {
            display: flex;
            justify-content: space-between;
        }
        
        .favorite-menu span {
            font-size: 16px;
            color: #6f6f6f;
        }
        
        .favorite-menu i.fas {
            color: #6f6f6f;
        }
        
        .people {
            display: flex;
            justify-content: space-between;
            overflow: auto;
            flex-shrink: 0;
            margin-right: -20px;
        }
        
        .profile:first-child {
            padding-left: 0;
        }
        
        .profile:last-child {
            padding-right: 0;
        }
        
        .profile {
            text-align: center;
            padding: 20px 10px 0 20px;
        }
        
        .profile img,
        .message img {
            width: 60px;
            height: 60px;
            border-radius: 50%;
            object-fit: cover;
            object-position: center;
        }
        
        .profile .profile-name {
            font-size: 14px;
            color: #a5a9ad;
            margin-top: 6px;
        }
        /* 聊天面板 */
        
        .message-panel {
            background: white;
            position: relative;
            border-radius: 48px 48px 0 0;
            overflow: hidden;
            display: flex;
        }
        
        .mask {
            width: 100%;
            height: 64px;
            border-radius: 48px 48px 0 0;
            position: absolute;
            background-image: linear-gradient(180deg, rgba(255, 255, 255, 1) 0%, rgba(255, 255, 255, 0.6) 60%, rgba(255, 255, 255, 0) 100%);
        }
        
        .messages {
            overflow: auto;
            padding-right: 12px;
            padding-bottom: 24px;
            width: 100%;
        }
        
        .message {
            display: flex;
            align-items: center;
            padding: 10px 12px 10px 24px;
        }
        
        .message .info {
            color: #a5a9ad;
            padding-left: 20px;
            font-size: 14px;
            min-width: 0;
        }
        
        .message .infos {
            display: flex;
            justify-content: space-between;
            flex: 1;
        }
        
        .message .info .name {
            color: #a5a9ad;
            padding-bottom: 8px;
        }
        
        .message .info .content {
            color: #657081;
            text-overflow: ellipsis;
            white-space: nowrap;
            overflow: hidden;
        }
        
        .message .time {
            font-size: 14px;
            color: #858a98;
            padding-top: 4px;
            align-self: flex-start;
            text-align: right;
        }
        
        .message.new {
            background: rgba(27, 131, 245, 0.05);
            border-radius: 0 24px 24px 0;
        }
        
        .message .new-message-icon {
            background: rgba(239, 102, 102, 1);
            border-radius: 7px;
            font-size: 12px;
            color: white;
            padding: 3px 6px;
            margin-top: 6px;
            text-wrap: nowrap;
        }
    </style>
</head>

<body>
    <div class="container">
        <div class="page">
            <div class="main-panel">
                <nav>
                    <div class="buttons">
                        <i class="fas fa-chevron-left fa-lg">
                           
                        </i>
                        <i class="fas fa-search fa-lg"></i>
                    </div>
                    <ul class="menu">
                        <li class="active">消息列表</li>
                        <li>我的好友</li>
                        <li>我的群聊</li>
                    </ul>
                </nav>
                <!-- 常用联系人面板 -->
                <section class="middle-panel">
                    <div class="favorite">
                        <div class="favorite-menu">
                            <span>常用联系人</span>
                            <i class="fas fa-ellipsis-h"></i>
                        </div>
                        <div class="people">
                            <div class="profile">
                                <img src="https://tse2-mm.cn.bing.net/th/id/OIP-C.CEDwspcmgXkgKY82RiC2_gAAAA?w=289&h=217&c=7&r=0&o=5&dpr=1.3&pid=1.7" alt="头像" class="profile-image">
                                <div class="profile-name">李佳</div>
                            </div>
                            <div class="profile">
                                <img src="https://tse2-mm.cn.bing.net/th/id/OIP-C.CEDwspcmgXkgKY82RiC2_gAAAA?w=289&h=217&c=7&r=0&o=5&dpr=1.3&pid=1.7" alt="头像" class="profile-image">
                                <div class="profile-name">李佳</div>
                            </div>
                            <div class="profile">
                                <img src="https://tse2-mm.cn.bing.net/th/id/OIP-C.CEDwspcmgXkgKY82RiC2_gAAAA?w=289&h=217&c=7&r=0&o=5&dpr=1.3&pid=1.7" alt="头像" class="profile-image">
                                <div class="profile-name">李佳</div>
                            </div>
                            <div class="profile">
                                <img src="https://tse2-mm.cn.bing.net/th/id/OIP-C.CEDwspcmgXkgKY82RiC2_gAAAA?w=289&h=217&c=7&r=0&o=5&dpr=1.3&pid=1.7" alt="头像" class="profile-image">
                                <div class="profile-name">李佳</div>
                            </div>
                        </div>
                    </div>
                </section>
                <!-- 聊天面板 -->
                <section class="message-panel">
                    <div class="mask"></div>
                    <div class="messages">
                        <div class="message   ">
                            <img src="https://ts1.cn.mm.bing.net/th?id=OIP-C.mmDNZvQcPEBMQlT42x-xLwAAAA&w=176&h=185&c=8&rs=1&qlt=90&o=6&dpr=1.3&pid=3.1&rm=2" alt="">
                            <div class="infos">
                                <div class="info">
                                    <div class="name">张三</div>
                                    <div class="content">哈喽!今天打算干什么?</div>
                                </div>
                                <div class="time">09:34 </div>
                            </div>
                        </div>
                        <div class="message   ">
                            <img src="https://ts1.cn.mm.bing.net/th?id=OIP-C.mmDNZvQcPEBMQlT42x-xLwAAAA&w=176&h=185&c=8&rs=1&qlt=90&o=6&dpr=1.3&pid=3.1&rm=2" alt="">
                            <div class="infos">
                                <div class="info">
                                    <div class="name">张三</div>
                                    <div class="content">哈喽!今天打算干什么?</div>
                                </div>
                                <div class="time">09:34 </div>
                            </div>
                        </div>
                        <div class="message  ">
                            <img src="https://ts1.cn.mm.bing.net/th?id=OIP-C.mmDNZvQcPEBMQlT42x-xLwAAAA&w=176&h=185&c=8&rs=1&qlt=90&o=6&dpr=1.3&pid=3.1&rm=2" alt="">
                            <div class="infos">
                                <div class="info">
                                    <div class="name">张三</div>
                                    <div class="content">哈喽!今天打算干什么?</div>
                                </div>
                                <div class="time">09:34 </div>
                            </div>
                        </div>
                        <div class="message new ">
                            <img src="https://ts1.cn.mm.bing.net/th?id=OIP-C.mmDNZvQcPEBMQlT42x-xLwAAAA&w=176&h=185&c=8&rs=1&qlt=90&o=6&dpr=1.3&pid=3.1&rm=2" alt="">
                            <div class="infos">
                                <div class="info">
                                    <div class="name">张三</div>
                                    <div class="content">哈喽!今天打算干什么?</div>
                                </div>
                                <div class="time">09:34
                                    <div class="new-message-icon">新消息</div>
                                </div>
                            </div>
                        </div>
                    </div>
                </section>
            </div>
        </div>
    </div>
</body>

</html>

效果图:

在这里插入图片描述

  • 1
    点赞
  • 0
    收藏
    觉得还不错? 一键收藏
  • 打赏
    打赏
  • 0
    评论

“相关推荐”对你有帮助么?

  • 非常没帮助
  • 没帮助
  • 一般
  • 有帮助
  • 非常有帮助
提交
评论
添加红包

请填写红包祝福语或标题

红包个数最小为10个

红包金额最低5元

当前余额3.43前往充值 >
需支付:10.00
成就一亿技术人!
领取后你会自动成为博主和红包主的粉丝 规则
hope_wisdom
发出的红包

打赏作者

你的美,让我痴迷

你的好,我会永远记住你的。

¥1 ¥2 ¥4 ¥6 ¥10 ¥20
扫码支付:¥1
获取中
扫码支付

您的余额不足,请更换扫码支付或充值

打赏作者

实付
使用余额支付
点击重新获取
扫码支付
钱包余额 0

抵扣说明:

1.余额是钱包充值的虚拟货币,按照1:1的比例进行支付金额的抵扣。
2.余额无法直接购买下载,可以购买VIP、付费专栏及课程。

余额充值