Not sure if there is a more eloquent way but this works... It is a combination of modifying the padding options in gt
and the margins in styles.css
:
# r code
tab1 <- dat |> select(car,2:3) |> gt() |> tab_options(container.padding.y = px(0))
tab2 <- dat |> select(car,4:7) |> gt() |> tab_options(container.padding.y = px(0))
tab3 <- dat |> select(car,8:11) |> gt() |> tab_options(container.padding.y = px(0))
/* CSS */
.gt_table {
margin-top: 0px !important;
margin-bottom: 0px !important;
}
Result: