<!DOCTYPE html> <html> <head> <title>Demo</title> <style type="text/css"> h1[id]:hover::after { content: " #"attr(id); } </style> </head> <body> <h1 id="test">测试标题</h1> </body> </html> <!-- 来自 编程之家 jb51.cc (jb51.cc)-->