首页 > 其他分享 >仿chatGPT或chatPDF的前端界面布局,css实现对话聊天布局代码,响应式左右分栏布局(附完整源代码)

仿chatGPT或chatPDF的前端界面布局,css实现对话聊天布局代码,响应式左右分栏布局(附完整源代码)

时间:2023-04-22 14:45:35浏览次数:42  
标签:flex 0px 左右分 color 布局 width background 源代码 border

chatPDF或者chatGPT的界面挺简洁的,就是一个左侧的列表以及右侧的对话列表,现在使用css实现这样的布局

充分运用了flex布局方式实现,左右分栏,以及对话形式展示效果

下面是效果图:

 

在手机设备看就隐藏左侧,右侧100%适应

 下面就是html和css的布局代码

<style>
    .chatpdf{
        display: flex;
        height: 100vh;
        flex-direction: row;
    }
    .chatpdf .pannel{
        width: 255px;
        background-color: rgb(0, 21, 41);
    }
    .chatpdfBox{
        display: flex;
        flex-direction: column;
        flex: 1;
        background: linear-gradient(to bottom right,#dbe6fb, #f3f4f8);
        background-size: cover;
        background-attachment: fixed;
    }
    .chatpdfLine{
        flex: 1;
        width: 100%;
        max-width: 1000px;
        margin: 0 auto;
        overflow-y: auto;
    }
    .chatpdfRow{
        margin: 20px 10px;
        display: flex;
    }
    .chatpdfAsk{
        justify-content: flex-end;
    }
    .chatpdfContent{
        display: inline-block;
        border-radius: 8px;
        padding: 6px 12px;
        max-width: 500px;
        background: rgba(255, 255, 255, 0.6);
        font-size: 14px;
        box-shadow:  0px 0.3px 0.9px rgba(0, 0, 0, 0.12), 0px 1.6px 3.6px rgba(0, 0, 0, 0.16);
    }
    .chatpdfAsk .chatpdfContent{
        background: linear-gradient(90deg, #2870EA 10.79%, #1B4AEF 87.08%);;
        color: #fff;
    }
    .chatpdfArea{
        display: flex;
        padding: 5px 10px;
        max-width: 1000px;
        margin: 0 auto;
        width: 100%;
    }
    .chatpdfArea textarea{
        flex: 1;
        border-color: #d9d9d9;
        resize: none;
        outline: none;
        padding: 0px 5px;
        height: 35px;
        line-height: 30px;
        color: #404040;
        border-radius: 10px 0px 0px 10px;
        transition: all 0.3s,height 0s;
    }
    .chatpdfArea textarea:hover{
        border-color: #4096ff;
    }
    .chatpdfArea button{
        height: 35px;
        color: #fff;
        background: linear-gradient(90deg, #2870EA 10.79%, #1B4AEF 87.08%);
        box-shadow: 0 2px 0 rgba(5, 145, 255, 0.1);
        border: none;
        padding: 0 20px;
        border-radius: 0px 8px 8px 0px;
        cursor: pointer;
    }
    .chatpdfArea button:hover{
        background-color: #388aff;
    }
    .chatpdf .fileTitle{
        background-color: #1677ff;
        color: #fff;
        border-radius: 8px;
        padding: 10px;
        margin: 10px;
        font-size: 14px;
        cursor: pointer;
    }
    @media (max-width: 768px) {
        .pannel{
            display: none;
        }
    }
</style>
<div class="chatpdf">
        <div class="pannel">
            <div class="fileList">
                <div class="fileTitle">新浪网技术(中国)有限公司.docx</div>
                <div class="fileTitle">新浪网技术(中国)有限公司.pdf</div>
                <div class="fileTitle">新浪网技术(中国)有限公司.xlsx</div>
            </div>
        </div>
        <div class="chatpdfBox">
            <div class="chatpdfLine">
                <div class="chatpdfRow">
                    <div class="chatpdfContent">我是知识库机器人,一个专门响应人类指令的大模型</div>
                </div>
                <div class="chatpdfRow">
                    <div class="chatpdfContent">我服务于人类,致力于让生活更美好</div>
                </div>
                <div class="chatpdfRow">
                    <div class="chatpdfContent">我是知识库机器人,一个专门响应人类指令的大模型</div>
                </div>
                <div class="chatpdfRow chatpdfAsk">
                    <div class="chatpdfContent">自建私有数据知识库 · 与知识库AI聊天</div>
                </div>
            </div>
            <div class="chatpdfArea">
                <textarea></textarea>
                <button>
                    <svg t="1682141916531" class="icon" viewBox="0 0 1024 1024" version="1.1" xmlns="http://www.w3.org/2000/svg" p-id="1271" width="16" height="16"><path d="M0 1024l106.496-474.112 588.8-36.864-588.8-39.936L0 0l1024 512z" fill="#ffffff" p-id="1272"></path></svg>
                </button>
            </div>
        </div>
    </div>

 

标签:flex,0px,左右分,color,布局,width,background,源代码,border
From: https://www.cnblogs.com/taoshihan/p/17343058.html

相关文章

  • 电力布局三维编辑器功能设计
    楔子最近和一家公司在谈一个项目合作,他们公司主要是做电力相关的。项目背景大概是这样的:国家电网对电网资产需要做到数字化管理,对现有变压器台区内的电表箱电能表做可视化数字孪生管理。由于涉及到的台区非常多,所以客户希望开发的不是单个项目,而是可以实现项目的3D编辑器,使得......
  • 如何阅读Tomcat源代码?
    容器,简单理解就是用来装东西的工具。在Tomcat里面,容器被设计用来装载Servlet,也就是我们平常写的普通的Servlet,就会存放在容器里面。这也就是咱们平常念叨的Servlet容器,其实从广义上理解,Servlet容器是指Tomcat,从狭义上理解,Servlet容器,只是Tomcat里面的一个组件而已。1.容器概述To......
  • 01-CSS中的非布局样式
    title:01-CSS中的非布局样式publish:true前言CSS中,有很多非布局样式,这些样式(属性)和与布局无关,包括:字体、字重、颜色、大小、行高背景、边框滚动、换行装饰性属性(粗体、斜体、下划线)等。这篇文章,我们来对上面的部分样式做一个回顾。边框如何用边框画一个三角形?详见......
  • 02-CSS布局
    title:02-CSS布局publish:true前言常见的布局属性(1)display确定元素的显示类型:block:块级元素。inline:行内元素。inline-block:对外的表现是行内元素(不会独占一行),对内的表现是块级元素(可以设置宽高)。(2)position确定元素的位置:static:默认属性值。relative:......
  • 13-CSS3属性:Flex布局图文详解
    title:13-CSS3属性:Flex布局图文详解publish:true前言CSS3中的flex属性,在布局方面做了非常大的改进,使得我们对多个元素之间的布局排列变得十分灵活,适应性非常强。其强大的伸缩性和自适应性,在网页开中可以发挥极大的作用。flex初体验我们先来看看下面这个最简单的布局:......
  • vue3学习之tabler组件Layout布局
    上一篇使用的bootstrap-vue-next项目迭代很快,考虑还未发文档和正式版本(自己菜)改用原生bootstrap模板tabler项目。tabler安装运行不想安装可直接打开tabler\demo目录下html文件浏览查看效果#获取后目录下运行npminstall#需要先安装https://github.com/oneclick/rubyinst......
  • 直播平台源代码,input密码框显示与隐藏
    直播平台源代码,input密码框显示与隐藏一、html部分   <divstyle="margin-top:200px;background:#42b983;width:200px;height:100px">   <input:type="passwordType"v-model="password"placeholder="请输入账号"/>   <img......
  • Bootstrap 应用-实现组合式上导航栏+侧边导航栏的布局
    今天继续学习使用bootstrap制作我们的主页面,上手以后发现bootstrap模板真的非常好用,效率很高,比较方便快捷。今天是主要把侧边栏做出来了,同时主要学习的是网格系统,然后用它做出了如图的主页。效果展示: 代码示例:<!DOCTYPEhtml><htmllang="en"><head><title>图像表格化......
  • 多列等高布局的实现
    前言很久没写过这种等高布局实现了,来重温一下经典。两栏布局,高度相等,高度由最高的内容撑开,左右两边高度不固定。固定html<!DOCTYPEhtml><htmllang="en"><head><metacharset="UTF-8"><metahttp-equiv="X-UA-Compatible"content="IE=edge......
  • UNIX环境高级编程 第三版 源代码编译及使用
    UNIX环境高级编程(第3版)中的代码示例多次包含了一下头文件:#include"apue.h"搜索发现原来这个头文件是作者自定义的一个文件,并在官网提供了源代码供下载。下载之后解压该文件:tar-zxfsrc.3e.tar.gz进入文件夹并编译:cdapue.3emake等待结束,如果没有报错就成功了。(如......