纯CSS制作冒泡提示框

王朝学院·作者佚名  2016-05-24
窄屏简体版  字體: 小  |  中  |  大  |  超大  

纯CSS制作冒泡提示框来源:http://www.ido321.com/1214.html

前两天翻译了一篇文章,关于利用css的border属性制作基本图形:http://www.ido321.com/1200.html

在此基础上,今天分享一篇文章给大家,如果利用CSS制作冒泡提示框。

先看2张效果图:

CSS:

/* 对话气泡 用法:使用.speech-bubble和.speech-bubble-DIRECTION类 <div class="speech-bubble speech-bubble-top">Hi there</div>*/ .speech-bubble { position: relative; background-color: #292929; width: 200px; height: 150px; line-height: 150px; /* 垂直居中 */ color: white; text-align: center; border-radius: 10px; font-family: sans-serif;} .speech-bubble:after { content: ''; position: absolute; width: 0; height: 0; border: 15px solid;} /* 箭头的位置 */.speech-bubble-top:after { border-bottom-color: #292929; left: 50%; bottom: 100%; margin-left: -15px; }.speech-bubble-right:after { border-left-color: #292929; left: 100%; top: 50%; margin-top: -15px; } .speech-bubble-bottom:after { border-top-color: #292929; top: 100%; left: 50%; margin-left: -15px; } .speech-bubble-left:after { border-right-color: #292929; top: 50%; right: 100%; margin-top: -15px; }

HTML:

<!DOCTYPE html><html> <head> <link rel="stylesheet" type="text/css" href="maopao.css"> <title>Test</title> </head> <body> <div class="speech-bubble speech-bubble-top"> 箭头在顶部 </div> <br/> <div class="speech-bubble speech-bubble-bottom"> 箭头在底部 </div> <br/> <div class="speech-bubble speech-bubble-left"> 箭头在左侧 </div> <br/> <div class="speech-bubble speech-bubble-right"> 箭头在右侧 </div> </body></html>

演示地址:http://jsfiddle.net/80r9kjs2/embedded/result/

下一篇:php:产生不重复随机数的方法

 
 
免责声明:本文为网络用户发布,其观点仅代表作者个人观点,与本站无关,本站仅提供信息存储服务。文中陈述内容未经本站证实,其真实性、完整性、及时性本站不作任何保证或承诺,请读者仅作参考,并请自行核实相关内容。
 
© 2005- 王朝網路 版權所有 導航