知向前端
首页
微语
登录
使用css画带气泡的三角形
2018-3-8 Jon
<!DOCTYPE html><html lang="en"><head><meta charset="UTF-8" /><meta name="viewport" content="width=device-width, initial-scale=1.0" /><meta http-equiv="X-UA-Compatible" content="ie=edge" /><title>Document</title>
<style>
body {
margin: 50px;
}
.bubble {
position: relative;
border: 1px solid #ccc;
width: 150px;
height: 120px;
border-radius: 5px;
}
.bubble::before, .bubble::after {
content: '';
border-left: 12px solid transparent;
border-top: 15px solid #ccc;
border-right: 12px solid transparent;
position: absolute;
bottom: -15px;
left: 50%;
transform: translateX(-50%);
}
.bubble::after {
border-top: 15px solid #fff;
bottom: -14px;
}
</style>
</head><body><div class="bubble"></div></body></html>
运行代码
您可以修改框中代码后运行查看
发表评论:
昵称
邮件地址 (选填)
个人主页 (选填)
内容