Apply custom class for a specific element based on operating system

After searching I found the following link

This link hides the element based on the operating system, but I don’t want to create two separate elements for each OS, I want to just apply some class on the specific element based on the OS.

For example

<div data-condition={if-ios=>cus-ios-cls, if-md=>cus-md-cls}>



</div>

I can achieve this through JavaScript, but I want to know is any alternative way.