How to change CSS according to user Operating System

♀尐吖头ヾ 提交于 2020-05-08 16:16:26

问题


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;
}

回答1:


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);


来源:https://stackoverflow.com/questions/39012649/how-to-change-css-according-to-user-operating-system

易学教程内所有资源均来自网络或用户发布的内容,如有违反法律规定的内容欢迎反馈
该文章没有解决你所遇到的问题?点击提问,说说你的问题,让更多的人一起探讨吧!