js+css实现响应式自适应兼容手机的聊天对话框交互通讯效果代码
代码语言:html
所属分类:响应式
代码描述:js+css实现响应式自适应兼容手机的聊天对话框交互通讯效果代码
代码标签: js css 兼容 手机 响应式 聊天 对话 框 交互 通讯
下面为部分代码预览,完整代码请点击下载或在bfwstudio webide中打开
<!DOCTYPE html>
<html lang="en" >
<head>
<meta charset="UTF-8">
<style>
* {
box-sizing: border-box;
margin: 0;
padding: 0;
}
body {
background-color: #673ab7;
}
body,
button,
input,
select {
font-family: Source Sans Pro, sans-serif;
}
.bot-response {
font-size: 17px;
line-height: 24px;
border-radius: 20px;
word-wrap: break-word;
max-width: fit-content;
padding: 15px 17px;
background: rgb(255, 255, 255);
color: rgb(0, 0, 0);
margin-top: 10px;
}
.text[text-first] {
border-bottom-left-radius: 5px;
margin-top: 0;
}
.text[text-middle] {
border-bottom-left-radius: 5px;
border-top-left-radius: 5px;
}
.text[text-last] {
border-top-left-radius: 5px;
}
.massage[data-user="true"] {
display: flex;
justify-content: flex-end;
}
.msgCaption {
padding: 0 25px 10px !important;
padding-top: 10px !important;
}
.user-response {
background: rgb(0, 102, 255);
color: rgb(255, 255, 255);
font-size: 17px;
line-height: 24px;
border-radius: 20px;
max-width: 250px;
padding: 15px 17px;
border-bottom-right-radius: 5px;
word-break: break-all;
white-space: normal;
}
.massage {
padding: 0 25px 0px;
}
.massage img {
width: 100%;
height: 217px;
background: white;
border-radius: 10px;
margin-bottom: 6px;
}
.captionBot img {
width: 18px;
height: 18px;
border-radius: 100%;
}
.captionBot {
display: flex;
justify-content: space-between;
padding: 0 25px;
width: 117px;
font-size: 14px;
color: rgb(24, 25, 25);
}
a {
text-decoration: none;
}
.by a {
font-size: 14px;
font-weight: 600;
margin-left: 3px;
}
.by {
display: flex;
justify-content: center;
align-items: center;
height: 30px;
border-top: 1px solid rgb(238, 238, 238);
}
.by span {
color: rgb(155, 166, 178);
font-size: 12px;
font-weight: 600;
}
.InputMSG {
outline: none;
border: none;
width: 100%;
height: 50px;
padding-left: 15px;
font-size: 1.1rem;
}
.InputMSG::placeholder {
font-size: 1.1rem;
color: rgb(155, 166, 178);
}
.BoxSentMSG {
display: flex;
align-items: center;
width: 100%;
height: 50px;
}
.send-icon {
display: flex;
background-color: white;
width: 26px;
height: 26px;
margin: 0 13px;
cursor: pointer;
}
.ContentChat {
background: rgb(234, 238, 243);
width: 100%;
height: 400px;
overflow-y: scroll;
}
.ContentChat::before {
content: "";
display: block;
height: 20px;
width: 100%;
}
.ContentChat::after {
content: "";
display: block;
height: 20px;
width: 100%;
}
.AvatarBot {
display: grid;
position: relative;
justify-content: center;
align-items: center;
}
.AvatarBot:after {
content: "";
display: block;
width: 9px;
height: 9px;
border-radius: 100%;
border: 1px solid rgb(255, 255, 255);
background: rgb(105, 222, 64);
position: absolute;
bottom: 1px;
right: 1px;
}
.InfoBot {
margin-left: 17px;
}
.status {
color: rgb(155, 166, 179);
}
.TitleBot {
font-size: 24px;
font-weight: 600;
white-space: nowrap;
}
.AvatarBot img {
width: 50px;
height: 50px;
}
.top {
display: flex;
align-items: center;
height: 90px;
width: 100%;
padding-left: 13px;
-webkit-box-shadow: 0 9.5px 12.7px 0 rgba(0, 0, 0, 0.05);
box-shadow: 0 9.5px 12.7px 0 rgba(0, 0, 0, 0.05);
}
.container {
width: 400px;
height: 570px;
background-color: white;
box-shadow: 0 4px 16px rgba(0, 0, 0, 0.25);
border-radius: 15px;
margin: 50px auto;
}
.InputMSG:valid ~ .send-icon svg path {
fill: #0066ff;
}
.none {
display: none;
}
@media only screen and (max-width: 500px) {
.container {
width: 100%;
height: 100%;
border-radius: 0px;
}
body {
display: block;
height: calc(100vh - 170px);
overflow: auto;
}
.ContentChat {
height: 100%;
margin-top: 90px;
margin-bottom: 80px;
overflow: auto;
}
.top {
position: fixed;
top: 0;
left: 0;
right: 0;
background-color: white;
}
.BoxSentMSG {
position: fixed;
bottom: 30px;
left: 0;
right: 0;
background-color: white;
}
.by {
position: fixed;
bottom: 0;
left: 0;
right: 0;
background-color: white;
}
}
</style>
</head>
<body>
<!-- partial:index.partial.html -->
<div class="container">
<div class="top">
<div class="AvatarBot">
<img src="//repo.bfw.wiki/bfwrepo/icon/6413f21abdbea.png" alt="RagBot">
</div>
<div class="InfoBot">
<p class="TitleBot">RagBot</p>
<p class="status">Online</p>
</div>
</div>
<div class="ContentChat"></div>
<div class="BoxSentMSG ">
<input type="text " placeholder="Type your message here " class="InputMSG " required>
<div class="send-icon">
<svg id="send1" xmlns="http://www.w3.org/2000/svg " viewBox="0 0 24 24 " xml:space="preserve ">
<path fill="#d7d7d7 "
d="M22,11.7V12h-0.1c-0.1,1-17.7,9.5-18.8,9.1c-1.1-0.4,2.4-6.7,3-7.5C6.8,12.9,17.1,12,17.1,12H17c0,0,0-0.2,0-0.2c0,0,0,0,0,0c0-0.4-10.2-1-10.8-1.7c-0.6-0.7-4-7.1-3-7.5C4.3,2.1,22,10.5,22,11.7z ">
</path>
</svg>
<svg id="send2" class="none" version="1.1" id="Layer_1" xmlns="http://www.w3.org/2000/svg" xmlns:xlink="http://www.w3.org/1999/xlink" x="0px" y="0px" width="24px" height="30px" viewBox="0 0 24 30" style="enable-background:new 0 0 50 50;" xml:space="preserve">
<rect x="0" y="10" width="4" height="10" fill="#333" opacity="0.2">
<animate attributeName="opacity" attributeType="XML" values="0.2; 1; .2" begin="0s" dur="0.6s"
.........完整代码请登录后点击上方下载按钮下载查看
网友评论0