Home > Article > Web Front-end > Create a triangular navigation prompt effect with CSS (code example)
The content of this article is about creating a triangular navigation prompt effect with CSS. It has certain reference value. Friends in need can refer to it. I hope it will be helpful to you.
<!DOCTYPE html PUBLIC "-//W3C//DTD XHTML 1.0 Transitional//EN" "http://www.w3.org/TR/xhtml1/DTD/xhtml1-transitional.dtd"> <html xmlns="http://www.w3.org/1999/xhtml"> <head> <meta http-equiv="Content-Type" content="text/html; charset=gb2312" /> <title>CSS制作一个三角的导航提示效果</title> </head> <style> #menu {width:500px;padding:0;margin:40px auto;list-style-type:none;} #menu li {width:100px; float:left; line-height:30px} #menu a {position:relative;display:block; text-decoration:none; background:#cccccc;width:100px; } #menu a span {display:block; font-weight:bold;color:#000; border-style:solid;border-width:0px 2px 2px 0px; border-color:#fff #fff #06a #fff;text-align:center; } #menu a em {display:none;} #menu a:hover {background:#FF0000;} #menu a:hover span {color:#fff; } #menu a:hover em {display:block; overflow:hidden; border:6px solid #06a; border-color:#06a #fff; border-width:6px 6px 0 6px; position:absolute; left:50%; top:100%;margin-left:-6px;} </style> <body> <ul id="menu"> <li><a href="#"><span>CSS教程</span><em></em></a></li> <li><a href="#"><span>CSS布局</span><em></em></a></li> <li><a href="#"><span>CSS兼容性</span><em></em></a></li> <li><a href="#"><span>CSS</span><em></em></a></li> </ul> </body> </html>
The effect is as follows:
The above is the complete introduction to the effect of making a triangle navigation prompt with CSS, if you want to know more about CSS3 tutorial, please pay attention to the PHP Chinese website.
The above is the detailed content of Create a triangular navigation prompt effect with CSS (code example). For more information, please follow other related articles on the PHP Chinese website!