By default, the html document created by the htmlwidgets::saveWidget
which use htmltools (for example, htmlwidgets::saveWidget (reactable(iris))
) has the following attributes in the body tag: <body style='margin: 9px; padding: 40px; ">
that leads to excessive padding from the top of the page.
I have tried to find any documentation how to change the "style='padding: 40px;'"
but there is no documentation, and in the code of the save_html function no styles are defined.
Please could you suggest how it is possible to change the style of the body tag and adjust the "padding: 40px" to the desired level?
CodePudding user response:
style=""
should be double quotes. You have a single quote and a double.
<body class="vsc-initialized" style="margin: 9px; padding: 40px;">
You can try overwriting with !important
.vsc-initialized{padding: 0px!important;}
CodePudding user response:
The direction to the solution has been provided by cpsievert in this thread
The final solution is the following:
object2save <- reactable(iris)
object2save$sizingPolicy$padding <- 4
htmlwidgets::saveWidget(object2save, file = "example.html",
selfcontained = FALSE, libdir = "lib")