meihuak It is possible. In fact, a CSS selector is added on tag pages, but the CSS applied to the tag is not always visible. The reason for this is that when the page is not refreshed, the tag selector does not appear.
For this, you will probably need JavaScript. The following extension applies styling based on tags:
Colored - An extension to color elements based on tag colors.
I haven't reviewed the code of this extension, but it could be a good starting point.