The Text and SpriteFont objects don't use CSS, so none of the CSS styling considerations are relevant. They render directly in to the canvas instead of using DOM elements.
You can probably use special characters like a non-breaking space to get blank spaces which still fill the background color. You could also try the [hide]
tag.
Thanks for the suggestions. Played around and doesn't seems to work.
The [hide] tag doesn't work. Once you hide, the background color doesn't apply anymore.
[background=#000000][hide]Extra Padding[/hide]change background color[/background]
If I hide the word "background", there will be an empty gap without the background color.
Tried the special characters but & nbsp; or & #160; or U+00A0 but is showing up as normal text instead of a non-breaking space.
[background=#000000]& nbsp; change background color & nbsp;[/background]
Is this what you meant though?