是否可以通过伪选择器::after 或::before 添加文本到特定单词?
例如。我想始终在“下载”一词旁边添加 pdf 图标。
[PDF] 下载
或者也许是另一种方法?
最佳答案
您在 pdf 上的链接需要包含 pdf,然后您可以使用此选择器:
a[href*="pdf"]:before {content: '[ICON] '}
a[href*="pdf"]:after {content: ' 😅';}
<a href="http://example.com/test.pdf" class="pdf">learn html and css in one week</a>
关于css - 在文本后添加内容,我们在Stack Overflow上找到一个类似的问题: https://stackoverflow.com/questions/44408817/