效果图(如果想要三角形请点击这里):&nbs p;
代码:
<ht ML > <head> <style ty PE ="text/css"> .message_s { pos IT ion: relative; cursor: pointer; } .message_s :after { position: absolute; content: ""; /*以下内容可以根据实际需要进行 调整 ---- -s tart------*/ top: 0px; left: -13px; /*改成:right: -13px; 圆 点显示在右侧*/ width: 8px; h ei ght: 8px; border-radius: 50%; background-color: # e98b7f; /*-----end------*/ } div { height: 30px; border: 1px #000 solid; width: 300px; line-height: 30px; padding: 0px 0px 0px 15px; } </style> <script> function clickAction() { console. LOG ("天不生我leader,键道万古长如夜!"); } </script> </head> <body> <div> <span class=" ;m essage_s" onclick="clickAction()"></span> 剑开天门 </div> </body> </html>
附录:下面看下左上角实现 红色 三角号标识
左上角实现红色三角号标识,如图
利用 伪类 实现,position和transform、border属性为重点。
位置调整修改top和left的值即可。
<html> <head> <title> New Document </title> <style> div { background-color: #f4f4f4; padding: 20px; } .message_s { position: relative; } .message_s:after { position: absolute; top: -25px; dis play : block; width: 0; height: 0; border: 16px solid transparent; content: ""; - webkit -t ransform: rotate(45 deg ); } .message_s:after { left: -25px; z -i ndex: 0; border-right-color: red ; } </style> </head> <body> <div> <span class="message_s"> internet E xp lorer 10、Firefox、 opera 支持 transform 属性。Internet Explorer 9 支持替代的 -ms-transform 属性(仅适用于 2D 转换)。Safari 和 Ch rom e 支持替代的 -webkit-transform 属性(3D 和 2D 转换)。Opera 只支持 2D 转换。</span> </div> </body> </html>
到此这篇关于CSS3实现左上角或右上角显示提醒圆点的示例代码的 文章 就介绍到这了,更多相关css3提醒圆点内容请搜索以前的文章或继续浏览下面的相关文章,希望大家以后多多支持!
总结
以上是 为你收集整理的 CSS3实现左上角或右上角显示提醒圆点的示例代码 全部内容,希望文章能够帮你解决 CSS3实现左上角或右上角显示提醒圆点的示例代码 所遇到的问题。
如果觉得 网站内容还不错, 推荐好友。
查看更多关于CSS3实现左上角或右上角显示提醒圆点的示例代码的详细内容...
声明:本文来自网络,不代表【好得很程序员自学网】立场,转载请注明出处:http://www.haodehen.cn/did201532