The problem is that, although in the oh widget yaml a list card looks like it is one piece, it is actually many different html elements. Here’s what the html of a bare-bones card looks like:
So when you apply a setting via the card’s style property, OH simply cannot know which of those elements should get the style setting. In some widgets, the definition of the widget simply chooses one element to apply the style to (usually the top element), but in this case the style property is simply ignored.
In order to add custom styling to the card you will have to use the stylesheet property instead to directly inject css into the html of the widget.
For example, centering the title is accomplished with:
What I mean here is that the width of the item-inner class div is set to 100% so even if you try and center the content it will stretch to fill the whole space and it will not look like it’s being centered. You have to override the 100% width with a directive to autofit the width to the contents. That means adding the following to the stylesheet property as well:
I was going down the wrong route and tried with the ul and li selectors. Also didn’t know there was the need of a comma between .card-header and .item-content.
You need to put components like f7-card-header, f7-card-content and f7-card-footer directly under (you can remove what you don’t need as well as empty style or class properties in the above code), and then put the components you need directly under those. This allows you to customize the styles and applied classes at all levels. Note that headers and footers have justify-content: space-between by default so you can add multiple components and they will spread out nicely (as shown with the 3 buttons in the footer above).
FYI- There was an idea floated to have a oh-card component which the other cards would simply be based on, and which would allow you to customize headers and footers and possibly even the content by having separate slots (instead of having everything under default). There would be separate properties for header/content/footer classes and style.
This is not implemented as of now.