我有一个降价表如下:
| 1 | 2 | 3 |
|---|---|---|
| 4 | 5 | 6 |
| 7 | 8 | 9 |
Run Code Online (Sandbox Code Playgroud)
我希望将特定单元格的背景颜色设置为红色,例如单元格8.我发现一些讨论的论坛使用HTML语法来设置字体颜色,但没有发现任何人都可以将整个单元格背景颜色设置为红色.
小智 8
我在这里找到了一个适用于 Microsoft Visual Studio Code 预览的 Markdown 表格样式示例。
下面的例子在这里给出了这个结果
## 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>
Run Code Online (Sandbox Code Playgroud)