css3的聊天气泡样式

这次给大家带来css3的聊天气泡样式,做出css3的聊天气泡样式的注意事项有哪些,下面就是实战案例,一起来看一下。

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

css3的聊天气泡样式

图片式:

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

 

很抱歉,现在人工客服忙,让小jimi为您解答吧。

你好,我是stoneniqiu

登录后复制

样式:

 .jimi_lists {    margin: 0 -10px 20px 10px;    position: relative;} .jimi_lists .header_img.jimi3 {    background: url(../img/jimi_50_3.png) no-repeat 0 0;} .jimi_lists .header_img {    width: 50px;    height: 50px;    position: absolute;    top: 0;    left: 0;}.fl {    float: left;} .jimi_lists .msg {    margin-left: 59px;    margin-right: 40px;    margin-top: 2px;    float: left;    display: inline;} .jimi_lists .lt {    background: url(../img/msg_bg_lr.png) no-repeat 0 0;    width: 26px;    height: 10px;} .jimi_lists .tt {    background: url(../img/msg_bg_tb.png) repeat-x 0 -23px;    height: 10px;}.jimi_lists .rt {    background: url(../img/msg_bg_lr.png) no-repeat -35px 0;    width: 10px;    height: 10px;}.jimi_lists .lm {    background: url(../img/msg_bg_lr.png) repeat-y -94px 0;    width: 26px;    vertical-align: top;    position: relative;}.jimi_lists .mm {    padding: 0 5px;    background-color: #FFF;    word-break: break-all;    word-wrap: break-word;    color: #333;    line-height: 20px;}.jimi_lists .lm span {    background: url(../img/msg_bg_lr.png) no-repeat 0 -14px;    display: inline-block;    width: 26px;    height: 16px;    position: absolute;    top: 5px;}.jimi_lists .rm {    background: url(../img/msg_bg_lr.png) repeat-y -113px 0;    width: 10px;}.jimi_lists .lb {    background: url(../img/msg_bg_lr.png) no-repeat 0 -43px;    width: 10px;    height: 10px;}.jimi_lists .bm {    background: url(../img/msg_bg_tb.png) repeat-x 0 -25px;    height: 10px;}.jimi_lists .rb {    background: url(../img/msg_bg_lr.png) no-repeat -35px -43px;    width: 10px;    height: 10px;}.customer_lists {    position: relative;    margin: 0 12px 20px 20px;}.customer_lists .msg {    float: right;    margin-right: 73px;    _margin-right: 38px;    margin-top: 2px;}.customer_lists .lt {    background: url(../img/msg_bg_lr.png) no-repeat -47px -0;    width: 10px;    height: 10px;}.customer_lists .tt {    background: url(../img/msg_bg_tb.png) repeat-x 0 0;    height: 10px;}.customer_lists .rt {    background: url(../img/msg_bg_lr.png) no-repeat -63px 0;    width: 26px;    height: 10px;}.customer_lists .lm {    background: url(../img/msg_bg_lr.png) repeat-y -126px 0;    width: 10px;}.customer_lists .mm {    padding: 1px 8px;    background-color: #3897E7;    word-break: break-all;    word-wrap: break-word;    color: #FFF;}.customer_lists .rm {    background: url(../img/msg_bg_lr.png) repeat-y -129px 0;    width: 26px;    vertical-align: top;    position: relative;}.customer_lists .lb {    background: url(../img/msg_bg_lr.png) no-repeat -47px -36px;    width: 10px;    height: 10px;}.customer_lists .bm {    background: url(../img/msg_bg_tb.png) repeat-x -106px -4px;    height: 10px;}.customer_lists .rb {    background: url(../img/msg_bg_lr.png) no-repeat -63px -36px;    width: 26px;    height: 10px;}.customer_lists .rm span {    background: url(../img/msg_bg_lr.png) no-repeat -63px -14px;    display: inline-block;    width: 26px;    height: 16px;    position: absolute;    top: 5px;}.customer_lists .header_img_hover {    position: absolute;    background: url(../img/avatar_mask_01.png);    top: 0;    width: 50px;    height: 50px;}.customer_lists .header_img {    position: absolute;    top: 0;    right: 14px;    width: 50px;    height: 50px;} .clearfix:after {    content: " .";    display: block;    clear: both;    visibility: hidden;    height: 0;}

登录后复制

View Code

背景式:

第二种主要是使用了:before伪类画出了三角形,然后用定位拼在了一起。

  

换个气泡如何

这个不错

登录后复制

样式:

  .bkbubble.right p:before, .bkbubble.left p:before {      width: 0;    position: absolute;    top: 12px;    border-style: solid;    content: "";  }  .bkbubble.left {      text-align: right;  } .bkbubble.right p:before {     left: -12px;    border-color: transparent #00bfff;    border-width: 0 12px 12px 0; } .bkbubble.left p:before {     right: -12px;    border-color: transparent #00bfff;    border-width: 0 0 12px 12px ; }

登录后复制

更多三角形:http://www.cnblogs.com/lhb25/p/css-and-css3-triangle.html

边框式:

如果要求边框颜色和背景颜色不一样呢?上面的方法就不行了,因为用:before画三角形是利用border的原理,也就是说,在上面这种方式下,气泡边上的小三形是无法呈现两种颜色的,因为他只有一个border的颜色。那就要想办法凑出一个有边框的三角形了。

  

您好,请问有什么可以帮到您?

登录后复制

1.先画一个小矩形。

.lim_operator .lim_tale {    left: -1px;    background-color: #c8f064;    border-color: #a5d01b;    margin-left: 70px;}.lim_tale {    position: absolute;    width: 12px;    height: 8px;    overflow: hidden !important;    top: 10px;    z-index: 2;    border-top-style: solid;    border-top-width: 1px;}

登录后复制

css3的聊天气泡样式

2.画出斜线。

css里面是没有斜线的,这里是用了一个园的弧形拼出来的。在一个大圆上,截取一段弧,就是一条斜线了。

.lim_operator .radiusborder {    position: absolute;    background-color: #EFF0F2;    top: -29px;    left: -94px;    height: 160px;    width: 160px;    border-top-style: solid;    border-top-width: 1px;    border-right-style: solid;    border-right-width: 1px;    border-top-right-radius: 154px;    border-color: #a5d01b;}

登录后复制

叠加式:

原理就是相当于用before先画出一个有色背景,再用after画出一个白色背景,然后叠加错开顶部1-2px,这样就出现了一个有边框有背景的三角形。web 微信就是这种做法

.expression:before {    content: '';    position: absolute;    left: 16px;    top: 100%;    margin-left: -7px;    border: 7px solid transparent;    border-top-color: #CFCFCF}.expression:after {    content: '';    position: absolute;    left: 16px;    top: 100%;    margin-left: -7px;    margin-top: -1px;    border: 7px solid transparent;    border-top-color: #FFF}

登录后复制

相信看了本文案例你已经掌握了方法,更多精彩请关注【创想鸟】其它相关文章!

推荐阅读:

立即学习“前端免费学习笔记(深入)”;

注意事项

注意事项

以上就是css3的聊天气泡样式的详细内容,更多请关注【创想鸟】其它相关文章!

版权声明:本文内容由互联网用户自发贡献,该文观点仅代表作者本人。本站仅提供信息存储空间服务,不拥有所有权,不承担相关法律责任。如发现本站有涉嫌抄袭侵权/违法违规的内容, 请发送邮件至253000106@qq.com举报,一经查实,本站将立刻删除。

发布者:PHP中文网,转转请注明出处:https://www.chuangxiangniao.com/p/2899641.html

(0)
上一篇 2025年3月10日 23:48:34
下一篇 2025年3月6日 10:09:48

AD推荐 黄金广告位招租... 更多推荐

相关推荐

  • 详谈css样式初始化

    这次给大家带来详谈css样式初始化 ,css的样式初始化注意事项有哪些,下面就是实战案例,一起来看一下。      在网站编写的时候,由于许多的标签会有默认存在的样式,比如P标签的外边距,a标签的下划线等等,通常我们会把这些默认样式去除,以…

    编程技术 2025年3月10日
    200
  • 三种CSS截图的方法

    本文主要为大家分享三种CSS截图的方法 ,具有很好的参考价值,希望对大家有所帮助。一起跟随小编过来看看吧,希望能帮助到大家。 CSS截图图片的几种方式 原图: DIV   使用background-position:Xpx Ypx (图片左…

    2025年3月10日 编程技术
    200
  • css实现图片未加载完成时占位显示实例分享

    通过css控制,可以实现加载网络图片时,未加载完成的时候显示本地一张占位图,加载完成后显示网络图片; 原理:通过在img标签的after伪元素上添加一张占位图,并且img都设置为position:relative;after设置positi…

    2025年3月10日
    200
  • 用CSS实现Tab页切换效果的示例代码_CSS教程_CSS_网页制作

    最近切一个页面的时候涉及到了一个tab切换的部分,因为不想用js想着能不能用纯css的选择器来实现切换效果。搜了一下大致有下面三种写法。 1、利用 :hover 选择器 缺点:只有鼠标在元素上面的时候才有效果,无法实现选中和默认显示某一个的…

    2025年3月10日
    200
  • 清除css浮动的方法

    这次给大家带来清除css浮动的方法,清除css浮动的css浮动有哪些,下面就是实战案例,一起来看一下。 一,我们为什么要浮动 为什么浮动,为什么要css浮动,以及清除浮动的方法。在网页布局的时候有时需要元素并排显示,如果不选择浮动,那么那些…

    2025年3月10日 编程技术
    200
  • 使用CSS做出3D翻页效果

    这次给大家带来使用CSS做出3D翻页效果,使用CSS做出3D翻页效果的注意事项有哪些,下面就是实战案例,一起来看一下。 今天开始~小编将与大家分享一系列的web前端特效荟萃,喜欢把玩儿炫酷效果的小伙伴快快看过来^_^ ,希望大家喜欢呦~ 第…

    2025年3月10日
    200
  • css3如何做出小于一像素的细线

    这次给大家带来css3如何做出小于一像素的细线,css3做出小于一像素的细线的注意事项有哪些,下面就是实战案例,一起来看一下。 Webapp中的CSS3实现 0.5px的细线 感觉很长时间没写过博客了,最近生活还算稳定,过得较为充实,所以又…

    2025年3月10日 编程技术
    200
  • css判断子元素个数

    这次给大家带来css判断子元素个数,css判断子元素个数的注意事项有哪些,下面就是实战案例,一起来看一下。 工作时遇到这样一个问题:根据某元素所包含的子元素个数,分别设置不同的样式,这个用js可以解决,不过个人认为用css解决可能更简单一点…

    2025年3月10日 编程技术
    200
  • CSS的定位属性详解

    这次给大家带来CSS的定位属性详解,使用CSS定位属性的注意事项有哪些,下面就是实战案例,一起来看一下。 CSS的定位属性有三种,分别是注意事项、相对定位、固定定位。 position: absolute; position: relati…

    2025年3月10日 编程技术
    200
  • CSS实现波浪移动

    这次给大家带来CSS实现波浪移动,CSS实现波浪移动的注意事项有哪些,下面就是实战案例,一起来看一下。 在某些页面上常常看到波浪的效果,虽然只有装饰的作用,但是却让页面看上去更生动了,同时某些情况下也能起到注意事项的作用,而波浪的形式却比普…

    2025年3月10日
    200

发表回复

登录后才能评论