虚位以待,此位置招租
虚位以待,此位置招租
虚位以待,此位置招租
虚位以待,此位置招租
虚位以待,此位置招租
虚位以待,此位置招租
DeepSook聚合登录 阿里云服务器 99元/年 大流量卡 - 免开卡,免运费 此位置招租 此位置招租 此位置招租 此位置招租 此位置招租 此位置招租 此位置招租 此位置招租 此位置招租 此位置招租 此位置招租 此位置招租 此位置招租 此位置招租 此位置招租
输入验证码,即可复制
扫描二维码输入:jiuge,即可获取验证码
只需要3秒时间
返回列表 发布新帖

[代码特效] HTML&CSS :AI聊天框界面

6 0
发表于 昨天 09:09 | 查看全部 阅读模式
这段代码实现了一个带有动态效果的聊天机器人界面,包含输入框、操作按钮和标签区域,整体风格为深色主题,带有渐变和阴影效果。

演示效果
bd33fa0b61e9ae932e25ac504babf387.gif

HTML&CSS
  1. <!DOCTYPE html>
  2. <html lang="zh">
  3. <head>
  4.     <meta charset="UTF-8">
  5.     <meta name="viewport" content="width=device-width, initial-scale=1.0">
  6.     <title>公众号关注:前端Hardy</title>
  7.     <style>
  8.         body {
  9.             margin: 0;
  10.             padding: 0;
  11.             background: #212121;
  12.             display: flex;
  13.             align-items: center;
  14.             justify-content: center;
  15.             height: 100vh;
  16.         }

  17.         .container_chat_bot {
  18.             display: flex;
  19.             flex-direction: column;
  20.             max-width: 260px;
  21.             width: 100%;
  22.         }

  23.         .container_chat_bot .container-chat-options {
  24.             position: relative;
  25.             display: flex;
  26.             background: linear-gradient(to bottom right,#7e7e7e,#363636,#363636,#363636,#363636);
  27.             border-radius: 16px;
  28.             padding: 1.5px;
  29.             overflow: hidden;

  30.             &::after {
  31.                 position: absolute;
  32.                 content: "";
  33.                 top: -10px;
  34.                 left: -10px;
  35.                 background: radial-gradient(ellipse at center, #ffffff,  rgba(255, 255, 255, 0.3),  rgba(255, 255, 255, 0.1),  rgba(0, 0, 0, 0),  rgba(0, 0, 0, 0),  rgba(0, 0, 0, 0),  rgba(0, 0, 0, 0));
  36.                 width: 30px;
  37.                 height: 30px;
  38.                 filter: blur(1px);
  39.             }
  40.         }

  41.         .container_chat_bot .container-chat-options .chat {
  42.             display: flex;
  43.             flex-direction: column;
  44.             background-color: rgba(0, 0, 0, 0.5);
  45.             border-radius: 15px;
  46.             width: 100%;
  47.             overflow: hidden;
  48.         }

  49.         .container_chat_bot .container-chat-options .chat .chat-bot {
  50.             position: relative;
  51.             display: flex;
  52.         }

  53.         .container_chat_bot .chat .chat-bot textarea {
  54.             background-color: transparent;
  55.             border-radius: 16px;
  56.             border: none;
  57.             width: 100%;
  58.             height: 50px;
  59.             color: #ffffff;
  60.             font-family: sans-serif;
  61.             font-size: 12px;
  62.             font-weight: 400;
  63.             padding: 10px;
  64.             resize: none;
  65.             outline: none;

  66.             &::-webkit-scrollbar {
  67.                 width: 10px;
  68.                 height: 10px;
  69.             }

  70.             &::-webkit-scrollbar-track {
  71.                 background: transparent;
  72.             }

  73.             &::-webkit-scrollbar-thumb {
  74.                 background: #888;
  75.                 border-radius: 5px;
  76.             }

  77.             &::-webkit-scrollbar-thumb:hover {
  78.                 background: #555;
  79.                 cursor: pointer;
  80.             }

  81.             &::placeholder {
  82.                 color: #f3f6fd;
  83.                 transition: all 0.3s ease;
  84.             }

  85.             &:focus::placeholder {
  86.                 color: #363636;
  87.             }
  88.         }

  89.         .container_chat_bot .chat .options {
  90.             display: flex;
  91.             justify-content: space-between;
  92.             align-items: flex-end;
  93.             padding: 10px;
  94.         }

  95.         .container_chat_bot .chat .options .btns-add {
  96.             display: flex;
  97.             gap: 8px;

  98.             & button {
  99.                 display: flex;
  100.                 color: rgba(255, 255, 255, 0.6);
  101.                 background-color: transparent;
  102.                 border: none;
  103.                 cursor: pointer;
  104.                 transition: all 0.3s ease;

  105.                 &:hover {
  106.                     transform: translateY(-5px);
  107.                     color: #ffffff;
  108.                 }
  109.             }
  110.         }

  111.         .container_chat_bot .chat .options .btn-submit {
  112.             display: flex;
  113.             padding: 2px;
  114.             background-image: linear-gradient(to top, #292929, #555555, #292929);
  115.             border-radius: 10px;
  116.             box-shadow: inset 0 6px 2px -4px rgba(255, 255, 255, 0.5);
  117.             cursor: pointer;
  118.             border: none;
  119.             outline: none;
  120.             transition: all 0.15s ease;

  121.             & i {
  122.                 width: 30px;
  123.                 height: 30px;
  124.                 padding: 6px;
  125.                 background: rgba(0, 0, 0, 0.1);
  126.                 border-radius: 10px;
  127.                 backdrop-filter: blur(3px);
  128.                 color: #8b8b8b;
  129.             }

  130.             & svg {
  131.                 transition: all 0.3s ease;
  132.             }

  133.             &:hover svg {
  134.                 color: #f3f6fd;
  135.                 filter: drop-shadow(0 0 5px #ffffff);
  136.             }

  137.             &:focus svg {
  138.                 color: #f3f6fd;
  139.                 filter: drop-shadow(0 0 5px #ffffff);
  140.                 transform: scale(1.2) rotate(45deg) translateX(-2px) translateY(1px);
  141.             }

  142.             &:active {
  143.                 transform: scale(0.92);
  144.             }
  145.         }

  146.         .container_chat_bot .tags {
  147.             padding: 14px 0;
  148.             display: flex;
  149.             color: #ffffff;
  150.             font-size: 10px;
  151.             gap: 4px;

  152.             & span {
  153.                 padding: 4px 8px;
  154.                 background-color: #1b1b1b;
  155.                 border: 1.5px solid #363636;
  156.                 border-radius: 10px;
  157.                 cursor: pointer;
  158.                 user-select: none;
  159.             }
  160.         }
  161.     </style>
  162. </head>

  163. <body>
  164.     <div class="container_chat_bot">
  165.         <div class="container-chat-options">
  166.             <div class="chat">
  167.                 <div class="chat-bot">
  168.                     <textarea id="chat_bot" name="chat_bot" placeholder="Imagine Something...✦˚"></textarea>
  169.                 </div>
  170.                 <div class="options">
  171.                     <div class="btns-add">
  172.                         <button>
  173.                             <svg xmlns="http://www.w3.org/2000/svg" width="20" height="20" viewBox="0 0 24 24">
  174.                                 <path fill="none" stroke="currentColor" stroke-linecap="round" stroke-linejoin="round"
  175.                                     stroke-width="2" d="M7 8v8a5 5 0 1 0 10 0V6.5a3.5 3.5 0 1 0-7 0V15a2 2 0 0 0 4 0V8">
  176.                                 </path>
  177.                             </svg>
  178.                         </button>
  179.                         <button>
  180.                             <svg viewBox="0 0 24 24" height="20" width="20" xmlns="http://www.w3.org/2000/svg">
  181.                                 <path
  182.                                     d="M4 5a1 1 0 0 1 1-1h4a1 1 0 0 1 1 1v4a1 1 0 0 1-1 1H5a1 1 0 0 1-1-1zm0 10a1 1 0 0 1 1-1h4a1 1 0 0 1 1 1v4a1 1 0 0 1-1 1H5a1 1 0 0 1-1-1zm10 0a1 1 0 0 1 1-1h4a1 1 0 0 1 1 1v4a1 1 0 0 1-1 1h-4a1 1 0 0 1-1-1zm0-8h6m-3-3v6"
  183.                                     stroke-width="2" stroke-linejoin="round" stroke-linecap="round"
  184.                                     stroke="currentColor" fill="none"></path>
  185.                             </svg>
  186.                         </button>
  187.                         <button>
  188.                             <svg viewBox="0 0 24 24" height="20" width="20" xmlns="http://www.w3.org/2000/svg">
  189.                                 <path
  190.                                     d="M12 22C6.477 22 2 17.523 2 12S6.477 2 12 2s10 4.477 10 10s-4.477 10-10 10m-2.29-2.333A17.9 17.9 0 0 1 8.027 13H4.062a8.01 8.01 0 0 0 5.648 6.667M10.03 13c.151 2.439.848 4.73 1.97 6.752A15.9 15.9 0 0 0 13.97 13zm9.908 0h-3.965a17.9 17.9 0 0 1-1.683 6.667A8.01 8.01 0 0 0 19.938 13M4.062 11h3.965A17.9 17.9 0 0 1 9.71 4.333A8.01 8.01 0 0 0 4.062 11m5.969 0h3.938A15.9 15.9 0 0 0 12 4.248A15.9 15.9 0 0 0 10.03 11m4.259-6.667A17.9 17.9 0 0 1 15.973 11h3.965a8.01 8.01 0 0 0-5.648-6.667"
  191.                                     fill="currentColor"></path>
  192.                             </svg>
  193.                         </button>
  194.                     </div>
  195.                     <button class="btn-submit">
  196.                         <i>
  197.                             <svg viewBox="0 0 512 512">
  198.                                 <path fill="currentColor"
  199.                                     d="M473 39.05a24 24 0 0 0-25.5-5.46L47.47 185h-.08a24 24 0 0 0 1 45.16l.41.13l137.3 58.63a16 16 0 0 0 15.54-3.59L422 80a7.07 7.07 0 0 1 10 10L226.66 310.26a16 16 0 0 0-3.59 15.54l58.65 137.38c.06.2.12.38.19.57c3.2 9.27 11.3 15.81 21.09 16.25h1a24.63 24.63 0 0 0 23-15.46L478.39 64.62A24 24 0 0 0 473 39.05">
  200.                                 </path>
  201.                             </svg>
  202.                         </i>
  203.                     </button>
  204.                 </div>
  205.             </div>
  206.         </div>
  207.         <div class="tags">
  208.             <span>Create An Image</span>
  209.             <span>Analyse Data</span>
  210.             <span>More</span>
  211.         </div>
  212.     </div>
  213. </body>
  214. </html>
复制代码


HTML 结构

  • container_chat_bot:整个聊天机器人的容器,包含聊天框和标签。
  • container-chat-options:聊天框的容器,包含背景和装饰效果。
  • chat:聊天框的主体部分,包含输入框和操作按钮。
  • chat-bot:聊天框的输入区域。
  • textarea:用户输入内容的文本框。
  • options:聊天框的操作区域,包含按钮。
  • btns-add:包含附加功能按钮的容器。
  • button:操作按钮,如添加功能按钮和提交按钮。
  • tags:显示标签的区域,包含多个标签。


CSS 样式

  • body:设置页面背景颜色、布局方式(居中对齐)和全屏高度。
  • .container_chat_bot:定义聊天机器人容器的布局方式和最大宽度。
  • .container-chat-options:定义聊天框的背景渐变、圆角和阴影效果,包含顶部装饰性渐变圆圈。
  • .chat:定义聊天框主体的背景颜色和圆角。
  • .chat-bot textarea:定义输入框的样式,包括透明背景、字体颜色、滚动条样式和占位符效果。
  • .options:定义操作区域的布局方式。
  • .btns-add button:定义附加功能按钮的样式,包括图标、悬停效果和动画。
  • .btn-submit:定义提交按钮的样式,包括背景渐变、阴影、悬停效果和点击动画。
  • .tags:定义标签区域的样式,包括字体颜色、背景颜色和间距。
  • .tags span:定义单个标签的样式,包括背景颜色、边框和圆角。

免责声明

本社区仅提供信息交流平台,帖子内容由用户自行发布,不代表社区立场。用户对发布内容负全责,包括版权、隐私、诽谤等,社区不承担因使用社区内容导致的损失。禁止发布侵权、隐私信息,发现侵权请联系我们。社区不负责第三方内容,用户因访问第三方内容产生的损失,社区不担责。用户须遵守规则和法律,不得发布违法、不当内容,违规内容将被删除。发表帖子即同意本声明,不同意请勿发帖。


特别提醒:网络空间并非法外之地,请广大用户自觉遵守法律法规,共同营造健康、文明、有序的网络环境。

本社区运营团队

联系我们: 如有疑问或发现违规行为,请联系管理员:kefu@foxccs.com

远方路灯明灭,银河倾斜,一斛星斗洒满天街。

回复

快捷回复: 经历想经历的,成为想成为的 - 九歌社区
您需要登录后才可以回帖 登录 | 立即注册

本版积分规则

投诉/建议联系

foxccs@qq.com

网站内容来源于网络,版权争议与本站无关。
请在下载后的24小时内从您的设备中彻底删除上述内容。

  • QQ交流群
  • 添加微信客服
Copyright © 2004-2025 九歌社区 版权所有 All Rights Reserved.
关灯 在本版发帖
扫一扫添加微信客服
官方QQ交流群
手机扫一扫访问
返回顶部
快速回复 返回顶部 返回列表