gpt4 book ai didi

markdown - 将 ID 或类添加到 Markdown 元素

转载 作者:行者123 更新时间:2023-12-02 14:32:41 25 4
gpt4 key购买 nike

是否可以向(多)markdown 元素添加 id 或 class?

例如表格、段落或代码块?

我想用 css 设计表格,但不进行以下工作:

[captionid][This is the caption, not the table id]
| First Header | Second Header |
| ------------- | ------------- |
| Content Cell | Content Cell |
| Content Cell | Content Cell |
<小时/>
| First Header  | Second Header |
| ------------- | ------------- |
| Content Cell | Content Cell |
| Content Cell | Content Cell |
[captionid][This is the caption, not the table id]
<小时/>
| First Header  | Second Header |
| ------------- | ------------- |
| Content Cell | Content Cell |
| Content Cell | Content Cell |
[tablecaption](#tableid)
<小时/>
<div class="special_table">

| First Header | Second Header |
| ------------- | ------------- |
| Content Cell | Content Cell |
| Content Cell | Content Cell |

</div>

网上找不到任何其他内容..

顺便说一句,我并不是指 github 或 stackoverflow 风格的 markdown。

最佳答案

出于 CSS 目的,您可以向前一个元素添加 id,然后使用选择器更改后一个元素。

这样的 Markdown :

<div class="special_table"></div>

| First Header | Second Header |
| ------------- | ------------- |
| Content Cell | Content Cell |
| Content Cell | Content Cell |

CSS 像这样:

div.special_table + table tr:nth-child(even) {background: #922}

关于markdown - 将 ID 或类添加到 Markdown 元素,我们在Stack Overflow上找到一个类似的问题: https://stackoverflow.com/questions/14732028/

25 4 0
Copyright 2021 - 2024 cfsdn All Rights Reserved 蜀ICP备2022000587号
广告合作:1813099741@qq.com 6ren.com