我在.markdown文档中使用锚链接,如下所示:
# {#infrared}
这很好,但是我想实现以下CSS,这样链接就可以滚动到页面的中间,而不是顶部:
.anchor {
position: absolute;
transform: translateY(-50vh);
}如何将类anchor添加到标记文档中的锚链接中?
发布于 2020-12-26 07:45:27
基于这个答案这里,我们有:
根据Goldmark的README 1,目前在Hugo中默认打开的Markdown处理器: 目前只有标题支持属性…。
## heading ## {#id .className attrName=attrValue class="class1 class2"}
## heading {#id .className attrName=attrValue class="class1 class2"}发布于 2020-12-25 15:15:31
我认为,总的来说,减价支持html标记,例如,您应该能够使用
<p class="anchor">text...</p>但无论哪种方式,如果它不能真正发挥作用,你就没有其他选择了。例如,“围栏代码属性”:
```{.red .numberLines startFrom="1"}这是一段。
再来一次。
这是从文档中复制的示例,这里有更多的选项:https://lifelongprogrammer.blogspot.com/2019/01/how-to-style-markdown-with-css.html
https://stackoverflow.com/questions/65448911
复制相似问题