如何在 markdown 中更改 table 的填充?
How to change padding of a table within markdown?
我正在使用 Jekyll Spaceship 构建 tables,我对 space 单行占用的空间不满意。我的 table 非常简单,我在降价文件中有它。
| Stage | Direct Products | ATP Yields |
| -----------------: | --------------: | ---------: |
| Glycolysis | 2 ATP ||
| Pyruvaye oxidation | 2 NADH | 5 ATP |
| Citric acid cycle | 2 ATP ||
| 30--32 ATP |||
我的问题是文本甚至不占单元格的一半 space,文本上下都有填充。
如何减少 table 中行的降价文件中的填充?
我也试过添加以下...
<style>
table, th, td {
padding: 1px;
}
</style>
<div class="bettertd">
| .... placed markdown tables here ... |
</div>
然后将其放入 CSS ...
.features table {
styles="padding:1px";
}
但是没用。
首先,您可以为 table 指定一个 class,如下所示:
| Stage | Direct Products | ATP Yields |
| -----------------: | --------------: | ---------: |
| Glycolysis | 2 ATP ||
| Pyruvaye oxidation | 2 NADH | 5 ATP |
| Citric acid cycle | 2 ATP ||
| 30--32 ATP |||
{:.custom-table}
第二步,您需要将自定义 css 样式添加到您的 jekyll 主题 css 文件中(通常在 _sass
文件夹下并命名为 *.sass
) .
//...
.custom-table th, .custom-table td {
padding: 1px;
// any style you want ...
}
或者添加到你的主题post布局的头部(通常在_layout
文件夹下,名为*.html
)。
<html>
<head>
<!-- ... -->
<style>
.custom-table th, .custom-table td {
padding: 1px;
// any style you want ...
}
</style>
</head>
<body>
...
</body>
<html>
或者甚至你使用jekyll-spaceship
的element-processor
来修改元素样式(Click for more usage details),将配置添加到你的_config.yml
如下:
jekyll-spaceship:
element-processor:
css:
- [.custom-table th, .custom-table td]: # Select the th, td nodes of custom table
props: # Replace element properties
style: # Add style attributes (Hash Style)
padding: 1px # Add padding
# font-size: '1.2em' # Add any style that you want
我正在使用 Jekyll Spaceship 构建 tables,我对 space 单行占用的空间不满意。我的 table 非常简单,我在降价文件中有它。
| Stage | Direct Products | ATP Yields |
| -----------------: | --------------: | ---------: |
| Glycolysis | 2 ATP ||
| Pyruvaye oxidation | 2 NADH | 5 ATP |
| Citric acid cycle | 2 ATP ||
| 30--32 ATP |||
我的问题是文本甚至不占单元格的一半 space,文本上下都有填充。
如何减少 table 中行的降价文件中的填充?
我也试过添加以下...
<style>
table, th, td {
padding: 1px;
}
</style>
<div class="bettertd">
| .... placed markdown tables here ... |
</div>
然后将其放入 CSS ...
.features table {
styles="padding:1px";
}
但是没用。
首先,您可以为 table 指定一个 class,如下所示:
| Stage | Direct Products | ATP Yields |
| -----------------: | --------------: | ---------: |
| Glycolysis | 2 ATP ||
| Pyruvaye oxidation | 2 NADH | 5 ATP |
| Citric acid cycle | 2 ATP ||
| 30--32 ATP |||
{:.custom-table}
第二步,您需要将自定义 css 样式添加到您的 jekyll 主题 css 文件中(通常在 _sass
文件夹下并命名为 *.sass
) .
//...
.custom-table th, .custom-table td {
padding: 1px;
// any style you want ...
}
或者添加到你的主题post布局的头部(通常在_layout
文件夹下,名为*.html
)。
<html>
<head>
<!-- ... -->
<style>
.custom-table th, .custom-table td {
padding: 1px;
// any style you want ...
}
</style>
</head>
<body>
...
</body>
<html>
或者甚至你使用jekyll-spaceship
的element-processor
来修改元素样式(Click for more usage details),将配置添加到你的_config.yml
如下:
jekyll-spaceship:
element-processor:
css:
- [.custom-table th, .custom-table td]: # Select the th, td nodes of custom table
props: # Replace element properties
style: # Add style attributes (Hash Style)
padding: 1px # Add padding
# font-size: '1.2em' # Add any style that you want