如何根据用户操作系统更改CSS

时间:2016-08-18 07:52:01

标签: css html5 google-app-engine responsive-design less

我如何编写处理Mac OS上不同效果的CSS,以及其他操作系统版本上的不同效果。

即。

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


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

1 个答案:

答案 0 :(得分:1)

你无法用纯CSS做到这一点,你可以使用JavaScript检测MAX或WIN等操作系统,然后用它来加载不同的CSS样式。

您可以使用view.translatesAutoresizingMaskIntoConstraints = false 的结果查找有关操作系统的信息。



 def sum(xs: List[Int]): Int = { 
  def loop(accum: Int, xs: List[Int]): Int = { 
    if (xs.isEmpty) accum
    else loop(accum + xs.head, xs.tail)
  }
  loop(0,xs)  
}