Doing type checking with isinstance instead of class names

`|css_class` will be kept for backwards compatibility, however is not a
good practice to type check this way, as subclasses don't get recognized
as these types, because they don't have `__name__` attribute set the same
way as the parent class.

Patch for issue #176