Quarto HTML中如何隐藏页脚脚注,仅保留悬停提示?
解决Quarto悬停提示不显示页脚脚注的问题
方法1:通过外部CSS文件实现
Quarto生成的HTML里,所有页脚脚注会被包裹在类名为footnotes的容器中,只需添加CSS规则隐藏这个容器,就能保留悬停提示功能同时移除页脚脚注。
修改后的.qmd代码
--- format: html: footnotes-hover: true css: styles.css --- The following footnote is available on hovering^[This footnote should only be displayed when hovering the text, not in page footer.]
对应的styles.css内容
/* 隐藏页脚的脚注容器 */ .footnotes { display: none; }
方法2:内嵌CSS(无需额外文件)
如果不想单独创建CSS文件,可直接在.qmd文档中嵌入样式:
--- format: html: footnotes-hover: true --- <style> .footnotes { display: none; } </style> The following footnote is available on hovering^[This footnote should only be displayed when hovering the text, not in page footer.]
原理说明
启用footnotes-hover: true后,Quarto会给正文的脚注标记添加悬停提示的交互逻辑,页脚的脚注列表是独立的容器。通过CSS隐藏.footnotes容器,只会移除页脚的脚注内容,完全不影响正文悬停提示的功能,且无需为每个提示编写硬编码HTML。
内容的提问来源于stack exchange,提问作者Edd
相关产品推荐
相关产品推荐

