Text alignment in roles

Is it possible to set the text alignment in a role?

The following styles on a role work well with a label with the exception of the text-align:

.anvil-role-mine {
  background-color: yellow;
  text-align: center;
  font-family: monospace;
  font-size: 20px;
  font-weight: bold;
}

I noticed that when a style is modified by both a role and a property, the property wins. For example if the background color of a label is set to red, then the background color set in the role is ignored. Perhaps the problem with the text alignment is that the property by default is set to left instead of being empty, so it always wins over the alignment on the role. Perhaps.

To override the properties I would try using !important

It works, thank you!

1 Like