纯CSS制作冒泡提示框_html/css_WEB-ITnose

php中文网
发布: 2016-06-24 11:53:56
原创
2063人浏览过

来源: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;   }
登录后复制

 

芦笋演示
芦笋演示

一键出成片的录屏演示软件,专为制作产品演示、教学课程和使用教程而设计。

芦笋演示 34
查看详情 芦笋演示

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:产生不重复随机数的方法




HTML速学教程(入门课程)
HTML速学教程(入门课程)

HTML怎么学习?HTML怎么入门?HTML在哪学?HTML怎么学才快?不用担心,这里为大家提供了HTML速学教程(入门课程),有需要的小伙伴保存下载就能学习啦!

下载
来源:php中文网
本文内容由网友自发贡献,版权归原作者所有,本站不承担相应法律责任。如您发现有涉嫌抄袭侵权的内容,请联系admin@php.cn
最新问题
开源免费商场系统广告
热门教程
更多>
最新下载
更多>
网站特效
网站源码
网站素材
前端模板
关于我们 免责申明 举报中心 意见反馈 讲师合作 广告合作 最新更新 English
php中文网:公益在线php培训,帮助PHP学习者快速成长!
关注服务号 技术交流群
PHP中文网订阅号
每天精选资源文章推送
PHP中文网APP
随时随地碎片化学习

Copyright 2014-2025 https://www.php.cn/ All Rights Reserved | php.cn | 湘ICP备2023035733号