相关疑难解决方法(0)

如何选择生成的内容?

我可以让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>
Run Code Online (Sandbox Code Playgroud)

如何使生成的内容("#my-id")可选,以便用户可以突出显示并复制它?

css pseudo-element

25
推荐指数
2
解决办法
4126
查看次数

标签 统计

css ×1

pseudo-element ×1