Not sure I fully understand the problem here, but given that you want to apply the background only behind the text and not on the entire th-element, I guess you could wrap the text in a span-element and apply the background-color to that instead of the entire th-element.