侯体宗的博客
  • 首页
  • Hyperf版
  • beego仿版
  • 人生(杂谈)
  • 技术
  • 关于我
  • 更多分类
    • 文件下载
    • 文字修仙
    • 中国象棋ai
    • 群聊
    • 九宫格抽奖
    • 拼图
    • 消消乐
    • 相册

div+CSS制作类似微信对话气泡效果的实例总结

微信(小程序)  /  管理员 发布于 7年前   254

在聊天的场景中,聊天内容需要用到气泡修饰,如下图。下面一一讲解。

一、图片式:

第一个样式是京东客服,气泡的圆角和钩子都是用了图片。使用了一个table组合成了一个圆角的框框。lm样式拼出了钩子。

 

XML/HTML Code复制内容到剪贴板
  1. <div class="jimi_lists clearfix">  
  2.                 <div class="header_img jimi3 fl"></div>  
  3.                 <table class="msg" cellspacing="0" cellpadding="0">  
  4.                     <tbody><tr><td class="lt"></td><td class="tt"></td><td class="rt"></td></tr>  
  5.                     <tr><td class="lm"><span></span></td><td class="mm"><span class="wel"><span class="visitor"><p>很抱歉,现在人工客服忙,让小JIMI为您解答吧。</p></span></span></td><td class="rm"></td></tr>  
  6.                     <tr><td class="lb"></td><td class="bm"></td><td class="rb"></td></tr><tr><td></td></tr>  
  7.                     </tbody>  
  8.                 </table>  
  9.             </div>  
  10.             <div class="customer_lists clearfix">  
  11.                 <div class="header_img jimi3" style="background: url(img/mine.jpg) no-repeat center;">  
  12.                     <div class="header_img_hover"></div>  
  13.                 </div>  
  14.                 <table class="msg" cellspacing="0" cellpadding="0"><tbody><tr><td class="lt"></td><td class="tt"></td><td class="rt"></td></tr><tr><td class="lm"></td><td class="mm">你好,我是stoneniqiu</td><td class="rm"><span></span></td></tr><tr><td class="lb"></td><td class="bm"></td><td class="rb"></td></tr><tr><td></td><td class="time"></td><td></td></tr></tbody></table>  
  15.             </div>  

样式:

CSS Code复制内容到剪贴板
  1. .jimi_lists {   
  2.     margin: 0 -10px 20px 10px;   
  3.     position: relative;   
  4. }   
  5.  .jimi_lists .header_img.jimi3 {   
  6.     background: url(../img/jimi_50_3.png) no-repeat 0 0;   
  7. }   
  8.  .jimi_lists .header_img {   
  9.     width: 50px;   
  10.     height: 50px;   
  11.     position: absolute;   
  12.     top: 0;   
  13.     left: 0;   
  14. }   
  15. .fl {   
  16.     float: left;   
  17. }   
  18.  .jimi_lists .msg {   
  19.     margin-left: 59px;   
  20.     margin-right: 40px;   
  21.     margin-top: 2px;   
  22.     float: left;   
  23.     display: inline;   
  24. }   
  25.  .jimi_lists .lt {   
  26.     background: url(../img/msg_bg_lr.png) no-repeat 0 0;   
  27.     width: 26px;   
  28.     height: 10px;   
  29. }   
  30.  .jimi_lists .tt {   
  31.     background: url(../img/msg_bg_tb.png) repeat-x 0 -23px;   
  32.     height: 10px;   
  33. }   
  34. .jimi_lists .rt {   
  35.     background: url(../img/msg_bg_lr.png) no-repeat -35px 0;   
  36.     width: 10px;   
  37.     height: 10px;   
  38. }   
  39. .jimi_lists .lm {   
  40.     background: url(../img/msg_bg_lr.png) repeat-y -94px 0;   
  41.     width: 26px;   
  42.     vertical-align: top;   
  43.     position: relative;   
  44. }   
  45. .jimi_lists .mm {   
  46.     padding: 0 5px;   
  47.     background-color: #FFF;   
  48.     word-break: break-all;   
  49.     word-wrap: break-word;   
  50.     color: #333;   
  51.     line-height: 20px;   
  52. }   
  53. .jimi_lists .lm span {   
  54.     background: url(../img/msg_bg_lr.png) no-repeat 0 -14px;   
  55.     display: inline-block;   
  56.     width: 26px;   
  57.     height: 16px;   
  58.     position: absolute;   
  59.     top: 5px;   
  60. }   
  61. .jimi_lists .rm {   
  62.     background: url(../img/msg_bg_lr.png) repeat-y -113px 0;   
  63.     width: 10px;   
  64. }   
  65. .jimi_lists .lb {   
  66.     background: url(../img/msg_bg_lr.png) no-repeat 0 -43px;   
  67.     width: 10px;   
  68.     height: 10px;   
  69. }   
  70. .jimi_lists .bm {   
  71.     background: url(../img/msg_bg_tb.png) repeat-x 0 -25px;   
  72.     height: 10px;   
  73. }   
  74. .jimi_lists .rb {   
  75.     background: url(../img/msg_bg_lr.png) no-repeat -35px -43px;   
  76.     width: 10px;   
  77.     height: 10px;   
  78. }   
  79.   
  80. .customer_lists {   
  81.     position: relative;   
  82.     margin: 0 12px 20px 20px;   
  83. }   
  84. .customer_lists .msg {   
  85.     float: rightright;   
  86.     margin-right: 73px;   
  87.     _margin-rightright: 38px;   
  88.     margin-top: 2px;   
  89. }   
  90. .customer_lists .lt {   
  91.     background: url(../img/msg_bg_lr.png) no-repeat -47px -0;   
  92.     width: 10px;   
  93.     height: 10px;   
  94. }   
  95. .customer_lists .tt {   
  96.     background: url(../img/msg_bg_tb.png) repeat-x 0 0;   
  97.     height: 10px;   
  98. }   
  99. .customer_lists .rt {   
  100.     background: url(../img/msg_bg_lr.png) no-repeat -63px 0;   
  101.     width: 26px;   
  102.     height: 10px;   
  103. }   
  104. .customer_lists .lm {   
  105.     background: url(../img/msg_bg_lr.png) repeat-y -126px 0;   
  106.     width: 10px;   
  107. }   
  108. .customer_lists .mm {   
  109.     padding: 1px 8px;   
  110.     background-color: #3897E7;   
  111.     word-break: break-all;   
  112.     word-wrap: break-word;   
  113.     color: #FFF;   
  114. }   
  115. .customer_lists .rm {   
  116.     background: url(../img/msg_bg_lr.png) repeat-y -129px 0;   
  117.     width: 26px;   
  118.     vertical-align: top;   
  119.     position: relative;   
  120. }   
  121. .customer_lists .lb {   
  122.     background: url(../img/msg_bg_lr.png) no-repeat

  • 上一条:
    CSS实现微信扫码特效
    下一条:
    CSS3 仿微信聊天小气泡实例代码
  • 昵称:

    邮箱:

    0条评论 (评论内容有缓存机制,请悉知!)
    最新最热
    • 分类目录
    • 人生(杂谈)
    • 技术
    • linux
    • Java
    • php
    • 框架(架构)
    • 前端
    • ThinkPHP
    • 数据库
    • 微信(小程序)
    • Laravel
    • Redis
    • Docker
    • Go
    • swoole
    • Windows
    • Python
    • 苹果(mac/ios)
    • 相关文章
    • 微信模板消息改版后发送规则记录(微信订阅消息参数值内容限制说明)(1个评论)
    • 微信支付v3对接所需工具及命令(0个评论)
    • 2023年9月1日起:微信小程序必须备案才能上线运营(0个评论)
    • 腾讯官方客服回应了:微信好友上限约10000个!(1个评论)
    • 2023年做微信小程序的老铁注意:新增收费项、微信小程序获取手机号也收费了(2个评论)
    • 近期文章
    • 在go语言中使用api.geonames.org接口实现根据国际邮政编码获取地址信息功能(1个评论)
    • 在go语言中使用github.com/signintech/gopdf实现生成pdf分页文件功能(0个评论)
    • gmail发邮件报错:534 5.7.9 Application-specific password required...解决方案(0个评论)
    • 欧盟关于强迫劳动的规定的官方举报渠道及官方举报网站(0个评论)
    • 在go语言中使用github.com/signintech/gopdf实现生成pdf文件功能(0个评论)
    • Laravel从Accel获得5700万美元A轮融资(0个评论)
    • 在go + gin中gorm实现指定搜索/区间搜索分页列表功能接口实例(0个评论)
    • 在go语言中实现IP/CIDR的ip和netmask互转及IP段形式互转及ip是否存在IP/CIDR(0个评论)
    • PHP 8.4 Alpha 1现已发布!(0个评论)
    • Laravel 11.15版本发布 - Eloquent Builder中添加的泛型(0个评论)
    • 近期评论
    • 122 在

      学历:一种延缓就业设计,生活需求下的权衡之选中评论 工作几年后,报名考研了,到现在还没认真学习备考,迷茫中。作为一名北漂互联网打工人..
    • 123 在

      Clash for Windows作者删库跑路了,github已404中评论 按理说只要你在国内,所有的流量进出都在监控范围内,不管你怎么隐藏也没用,想搞你分..
    • 原梓番博客 在

      在Laravel框架中使用模型Model分表最简单的方法中评论 好久好久都没看友情链接申请了,今天刚看,已经添加。..
    • 博主 在

      佛跳墙vpn软件不会用?上不了网?佛跳墙vpn常见问题以及解决办法中评论 @1111老铁这个不行了,可以看看近期评论的其他文章..
    • 1111 在

      佛跳墙vpn软件不会用?上不了网?佛跳墙vpn常见问题以及解决办法中评论 网站不能打开,博主百忙中能否发个APP下载链接,佛跳墙或极光..
    • 2016-10
    • 2017-10
    • 2018-01
    • 2020-03
    • 2021-06
    • 2021-10
    • 2022-03
    • 2023-02
    • 2023-06
    • 2023-07
    • 2023-08
    • 2023-10
    • 2023-11
    Top

    Copyright·© 2019 侯体宗版权所有· 粤ICP备20027696号 PHP交流群

    侯体宗的博客