Spanning caption to max width when table is emtpy - kable

Hi!

I am sure this is really basic. I am just looking for some way to have an empty table with the caption spanning the full length instead of being clumped up. I tried some styling options with kableExtra but still not winning.

The reprex below doesn't 100% show my problem

library(magrittr)

knitr::kable(x = list(), caption = "No unique cards to display", format = "html")
No unique cards to display
# knitr::kable(x = list(), caption = "No unique cards to display", format = "html") %>%
# kableExtra::kable_styling(c("condensed"), full_width = T)
# 

Created on 2022-04-29 by the reprex package (v2.0.0)

As you can see on the image here this is the exact problem I have (it looks different on the reprex)

I believe this is a CSS issue. By default, a browser will set the <caption>element to have display: table-caption which cause the rendering you see.

You can change this value display: table-cell for example, and it will span across the table space

caption {
    display: table-cell
}

more on this

Hope it helps