【发布时间】:2011-11-15 10:29:57
【问题描述】:
我正在做一个小项目。
我希望使用 css 内容属性和 :after 伪属性在另一个元素内添加一个锚标记 <a>。
例如
.classname:after { content: '<a>hello</a>'; }
// this will print "<a>hello</a>"
我需要它做的是让它有一个有效的锚标记,指向一个给定的href。
我知道你可以使用类似content: attr(title); 这样的东西,所以它会使用.classname title 属性作为文本,我不知道这是否可能,但如果可以的话,那就太酷了。
【问题讨论】:
标签: css pseudo-element