繁体   English   中英

在网页上显示链接ID

[英]Show link IDs on for web page

我是使用JS的新手,正在寻找一种在网页上显示页面上所有链接的所有ID的方式,这些ID像每个链接旁边的工具提示一样显示。 我希望制作一个书签,单击该书签将使这些工具提示出现。

谢谢罗伯特

您可以注入一些CSS来完成您想要的操作

 /*target <a> tags that have an id attribute*/ a[id]:after{ content:attr(id); position:absolute; margin-top:-1em; padding:0.1em 0.3em; background:rgba(0,0,0,0.5); color:white; font-size:0.8em; } 
 <p> some text and a <a href="#" id="id-1">link</a> to test the id tooltip and some more text and another <a href="#" id="id-2">link</a> to test some text and a <a href="#" id="id-3">link</a> to test the id tooltip and some other <a href="#" id="id-4">link</a> to testsome text and a <a href="#" id="id-5">link</a> to test the id tooltip and some more text and another <a href="#" id="id-6">link</a> to test </p> 

暂无
暂无

声明:本站的技术帖子网页,遵循CC BY-SA 4.0协议,如果您需要转载,请注明本站网址或者原文地址。任何问题请咨询:yoyou2525@163.com.

 
粤ICP备18138465号  © 2020-2024 STACKOOM.COM