Styling elements with a dot (.) in the class name

Viewed 55580

Hay I have an element like this

<span class='a.b'>

Unfortunately this class name comes from an eCommerce application and cannot be changed.

Can I style a class name with a dot in it?

like

.a.b { }
4 Answers

Perhaps you could scan the elements for these classes and add a class that you could style.

For instance, scan all elements with the “a.b” class and then add a new “style-ab” class or some such.

I haven’t posted any example code for this as people may want to use vanilla Javascript or jQuery and it’s a simple enough thing to do.

To clarify, my gaming framework does exactly as the OP described so translations could be applied to certain divs and spans. It’s not a nasty way to decide class names, it’s just useful for people creating markup when using a dictionary that has keys for phrases

Related