Chrispinus Onyancha Chrispinus Onyancha - 3 months ago 19
Less Question

How to change CSS according to user Operating System

How can i write CSS that handle a different effect on Mac OS and different on other OS versions.

i.e.

.(mac){
height: 100%;
width: 100%;
overflow: hidden;
}


.(win and linux){
height: 100%;
width: 100%;
overflow: scroll;
}

Answer

You cannot do this with pure CSS, you can detect OS like MAX or WIN with JavaScript, and then use that to load different CSS styles.

You can use the result of window.navigator to find information about the OS.

console.log(window.navigator);

Comments