gpt4 book ai didi

r - 如何在 xtable 生成的 HTML 表格中添加 cellspacing 和 cellpadding?

转载 作者:行者123 更新时间:2023-12-01 13:48:16 25 4
gpt4 key购买 nike

我想在 xtable 生成的 html 表格中添加间距或填充。print.xtable() 参数 html.table.attributes 对我不起作用。这是一个可以粘贴到 Rmd 文档中的示例 block 。

```{r results='asis'}
library(xtable)
print(xtable(cars), type='html',
html.table.attributes = 'cellspacing="5" cellpadding="5"',
include.rownames = FALSE, include.colnames=FALSE,
comment = FALSE)
```

这是一个简单的独立示例,我不想为此创建一个 css 文件:more details on the purpose .

最佳答案

您可以使用样式标签将 CSS 规则添加到 R Markdown 文档中的样式表。

 <style>
th,td{
padding:2px 5px 2px 5px;
}
</style>

关于r - 如何在 xtable 生成的 HTML 表格中添加 cellspacing 和 cellpadding?,我们在Stack Overflow上找到一个类似的问题: https://stackoverflow.com/questions/34063279/

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