其實可以對a標簽應用自定義樣式。
思路:
1.去掉默認的下划線樣式。
2.給元素加新的樣式,包括提示,默認狀態,選中狀態
3.默認狀態點狀下划線,提示隱藏,選中后下划線變實線,提示顯示。
<style> a{ position: relative; text-decoration: none; border-bottom: 1px dotted #ccc; padding-bottom: 5px; } a em{ display: none; position: absolute; padding: 5px; border: 1px solid #ccc; left: 20px; top: 30px; width: 60px; } a:hover{border-bottom: 1px solid #ccc;} a:hover em{ display: block; } </style> <a href="http://snowinmay.net/">我是噠噠<em>大家好我是噠噠</em></a>