With your selectors your specificity matches inbuilt so you need !important on both.
card_mod:
style:
ha-markdown $:
ha-markdown-element: |
td {
border: none !important;
padding: 0px !important;
}
You don’t need for card_mod to be applied at ha-markdown-element, so if you apply same style without that yaml selector the style will be higher in light dom and you won’t need !important as, although specificity still the same, the hops to the scope root of a higher style is less, so that style wins.
card_mod:
style:
ha-markdown $: |
td {
border: none;
padding: 0px;
}