微信小程序 实现对话框三角形

参考链接:
(1)流浪的诗人-微信对话框小三角形实现
https://www.cnblogs.com/wdlhao/p/5484141.html
【友情链接】https://github.com/wdlhao

(1)效果图
在这里插入图片描述

(2)代码

<!DOCTYPE html>
<html>
	<head>
		<title>微信会话小三角</title>
		<meta charset="utf-8">
		<style type="text/css">
			body {
				font-family: "Helvetica Neue",Helvetica,"Hiragino Sans GB","Microsoft YaHei","微软雅黑",Arial,sans-serif;
				height: 100%;
				-webkit-background-size: cover;
				background-size: cover;
				-webkit-font-smoothing: antialiased;
				line-height: 1.6;
			}
			::-webkit-scrollbar-track {
				background-color: transparent;
			}
			.bubble.right:before, .bubble.right:after {
				left: 100%;
			}
			.bubble.left:before, .bubble.left:after {
				left: 100%;
			}
			/* 1. 描绘出位置和形状;*/
			.bubble:before, .bubble:after {
				position: absolute;
				top: 14px;
				border: 6px solid transparent;
				content: " ";
			}
			/* 2.border-left:color,width设置; */
			.bubble.bubble_primary.right:after {
				border-left-color: #b2e281;
				border-left-width: 4px;
			}
			/*3。div背景颜色*/
			.bubble.bubble_primary.right {
				background-color: #b2e281;
				margin-bottom: 20px;
			}
			.bubble.bubble_primary.left {
				background-color: #b2e221;
			}
			.bubble.bubble_primary.left:before {
				border-right-color: #b2e281;
				border-right-width: 4px;
				left: -10px;
			}
			.bubble_cont {
				word-wrap: break-word;
				word-break: break-all;
				min-height: 25px;
			}
			.bubble {
				max-width: 500px;
				min-height: 1em;
				/* display: inline-block; */
				vertical-align: top;
				position: relative;
				text-align: left;
				font-size: 14px;
				border-radius: 3px;
				-moz-border-radius: 3px;
				-webkit-border-radius: 3px;
				margin: 0 10px;
			}
			.bubble_cont .plain {
				padding: 9px 13px;
			}
			pre {
				margin: 0;
				font-family: inherit;
				font-size: inherit;
				white-space: pre-wrap;
				word-break: initial;
			}
		</style>
	</head>
	<body>
		<div class="bubble js_message_bubble ng-scope bubble_primary right">
			<div class="bubble_cont ng-scope">
				<div class="plain">
					<pre class="js_message_plain ng-binding" >好久不见了,最近好吗?</pre>
				</div>
			</div>
		</div>
		<div class="bubble js_message_bubble ng-scope bubble_primary left">
			<div class="bubble_cont ng-scope" >
				<div class="plain">
					<pre class="js_message_plain ng-binding" >还好,你那边怎么样?</pre>
				</div>
			</div>
		</div>
	</body>
</html>
  • 0
    点赞
  • 1
    收藏
    觉得还不错? 一键收藏
  • 0
    评论
评论
添加红包

请填写红包祝福语或标题

红包个数最小为10个

红包金额最低5元

当前余额3.43前往充值 >
需支付:10.00
成就一亿技术人!
领取后你会自动成为博主和红包主的粉丝 规则
hope_wisdom
发出的红包
实付
使用余额支付
点击重新获取
扫码支付
钱包余额 0

抵扣说明:

1.余额是钱包充值的虚拟货币,按照1:1的比例进行支付金额的抵扣。
2.余额无法直接购买下载,可以购买VIP、付费专栏及课程。

余额充值