【发布时间】:2013-11-23 17:26:28
【问题描述】:
我可以让 CSS 使用生成的内容显示元素的 ID,如下所示:
<style>
h2:hover:after {
color: grey;
content: "#" attr(id);
float: right;
font-size: smaller;
font-weight: normal;
}
</style>
<h2 id="my-id">My ID</h2>
<p>Pellentesque habitant morbi tristique senectus et netus et.</p>
如何使生成的内容(“#my-id”)可选择,以便用户可以突出显示和复制它?
【问题讨论】:
-
但是你可以。这是“指针事件:无;”在这里回答:stackoverflow.com/questions/21753590/…
-
也可以查看这个 w3c 问题:github.com/w3c/csswg-drafts/issues/2894
标签: css pseudo-element