2023年,在文档里给字加拼音,用HTML的标签,并加入title属性,如下:
字
如果文档支持CSS样式,还可以通过设置::after伪元素来实现:
css .pinyin { position: relative; font-size: 10px; color: #999; }
.pinyin::after { content: attr(title); position: absolute; left: 100%; top: 0; white-space: nowrap; }
然后在HTML中使用:
这样在字旁边就会显示拼音。
字
如果文档支持CSS样式,还可以通过设置::after伪元素来实现:
css .pinyin { position: relative; font-size: 10px; color: #999; }
.pinyin::after { content: attr(title); position: absolute; left: 100%; top: 0; white-space: nowrap; }
然后在HTML中使用:
这样在字旁边就会显示拼音。