I’ve been using html tables in Markdown cards for a while, and have never been able to successfully style them within the html code itself.
So I’ve always had to resort to card_mod, which has been 100% reliable until the 2025.12.0 betas.
The required Dom paths seem to have changed, and I think I’ve got that sorted, but now often the styling isn’t shown on first load, but needs a refresh from the dashboard menu.
I’ve tried using the advised card_mod tricks - line breaking the Dom path on each shadow-root, using prepend: true, but without it making a difference.
I’m also finding that styles aren’t applied on Markdown cards within a closed expander card on first open. Works on second open though.
Here’s a semi-working code sample:
type: markdown
card_mod:
prepend: true
style:
ha-markdown $:
ha-markdown-element: |
table {
width: 100%;
}
td {
border: none;
padding: 0px;
vertical-align: middle;
}