Markdown 为标记表中的特定单元格设置背景色
我有一个降价表,如下所示:Markdown 为标记表中的特定单元格设置背景色,markdown,Markdown,我有一个降价表,如下所示: | 1 | 2 | 3 | |---|---|---| | 4 | 5 | 6 | | 7 | 8 | 9 | 我希望将特定单元格的背景色设置为红色,例如单元格8。我发现一些论坛讨论使用HTML语法设置字体颜色,但没有发现任何人可以将整个单元格的背景颜色设置为红色。背景颜色是样式的一部分。降价仅针对内容和结构 但是你可以用 如果您可以使用css3:td:n子项(n) 使用css2:td+td并再次覆盖它td+td+td 我找到了一个使用Microsoft Vis
| 1 | 2 | 3 |
|---|---|---|
| 4 | 5 | 6 |
| 7 | 8 | 9 |
我希望将特定单元格的背景色设置为红色,例如单元格8。我发现一些论坛讨论使用HTML语法设置字体颜色,但没有发现任何人可以将整个单元格的背景颜色设置为红色。背景颜色是样式的一部分。降价仅针对内容和结构 但是你可以用
- 如果您可以使用css3:
td:n子项(n)
- 使用css2:
并再次覆盖它td+td
td+td+td
我找到了一个使用Microsoft Visual Studio代码预览的降价表样式示例 下面的例子给出了这个结果
##降价中的表格样式
.热图{
宽度:70%;
文本对齐:居中;
}
.热图{
背景:灰色;
单词包装:打断单词;
文本对齐:居中;
}
.heatMap tr:nth child(1){背景:红色;}
.heatMap tr:nth child(2){背景:橙色;}
.heatMap tr:nth child(3){背景:绿色;}
|此表格中的所有内容都居中,表格仅占屏幕宽度的70%|
| -- | -- | -- | -- |
|这是红色的一排|
|这是橙色的一排|
|这是绿色的一排|
## Table Styling in Markdown
<style>
.heatMap {
width: 70%;
text-align: center;
}
.heatMap th {
background: grey;
word-wrap: break-word;
text-align: center;
}
.heatMap tr:nth-child(1) { background: red; }
.heatMap tr:nth-child(2) { background: orange; }
.heatMap tr:nth-child(3) { background: green; }
</style>
<div class="heatMap">
| Everything | in this table | is Centered | and the table will only take up 70% of the screen width |
| -- | -- | -- | -- |
| This | is | a | Red Row |
| This | is | an | Orange Row |
| This | is | a | Green Row |
</div>