css实现兼容手机和pc的自适应文字聊天客服窗口效果代码

代码语言:html

所属分类:响应式

代码描述:css实现兼容手机和pc的自适应文字聊天客服窗口效果代码

代码标签: css 兼容 手机 pc 自适应 文字 聊天 客服 窗口

下面为部分代码预览,完整代码请点击下载或在bfwstudio webide中打开

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

<head>

  <meta charset="UTF-8">



<meta name="viewport" content="width=device-width, initial-scale=1">
<link href="https://fonts.googleapis.com/css?family=Fira+Sans:400,700" rel="stylesheet"> 
  
  
  
<style>
@import url("https://fonts.googleapis.com/css2?family=Poppins:wght@400;700&display=swap");
* {
  margin: 0;
  padding: 0;
  box-sizing: border-box;
  transition: all 150ms ease-in-out;
}

button {
  border: 0;
  background-color: transparent;
  cursor: pointer;
}

div.minimize {
  height: 40px;
}

div.list--active {
  transform: translateX(0);
}
@media (max-width: 500px) {
  div.list--active {
    transform: translateX(50%);
  }
}

.conversation__bubble--left {
  position: relative;
}
.conversation__bubble--left .conversation__text {
  float: left;
  max-width: 85%;
  color: #e0f3ff;
  background-color: #4867cb;
}
.conversation__bubble--left:before {
  content: "";
  position: absolute;
  bottom: -6px;
  left: 0;
  width: 8px;
  height: 8px;
  border-bottom-right-radius: 10px;
  background-color: #32488f;
}

.conversation__bubble--right {
  position: relative;
}
.conversation__bubble--right .conversation__text {
  float: right;
  max-width: 85%;
  color: #332400;
  background-color: #cbad48;
}
.conversation__bubble--right:before {
  content: "";
  position: absolute;
  bottom: -6px;
  right: 0;
  width: 8px;
  height: 8px;
  border-bottom-left-radius: 10px;
  background-color: #8f7a32;
}

body {
  font-family: "Poppins", sans-serif;
  color: #122740;
  overflow-y: hidden;
}

.mask {
  width: 300px;
  height: 400px;
  overflow: hidden;
  position: absolute;
  bottom: 0;
  right: 5rem;
  border-top-left-radius: 10px;
  border-top-right-radius: 10px;
  animation: appear 1s ease-in 0s;
  box-shadow: 0 10px 20px rgba(0, 0, 0, 0.15), 0 3px 6px rgba(0, 0, 0, 0.1);
  transition: height 400ms cubic-bezier(0.65, 0.05, 0.36, 1);
}
@media (max-width: 500px) {
  .mask {
    right: 0;
    width: auto;
    height: 100vh;
  }
}

.container {
  width: 600px;
  height: 400px;
  display: flex;
  flex-direction: row;
  transform: translateX(-300px);
  transition: transform 400ms cubic-bezier(0.65, 0.05, 0.36, 1);
}
@media (max-width: 500px) {
  .container {
    width: 100%;
    height: 100%;
    transform: translateX(0);
  }
}

.list, .conversation .........完整代码请登录后点击上方下载按钮下载查看

网友评论0