<!DOCTYPE html>
<html class="mobile">
<head>
<meta charset="UTF-8">
<title></title>
<style type="text/css">
.mobile #div1{
background: skyblue;
}
.pc #div1{
background: pink;
}
.pad #div1{
background: salmon;
} .iphone #div1{
background: yellow;
}
.android #div1{
background: seagreen;
}
#div1{
height: 100px;
}
</style>
</head>
<body>
<div id="div1" > </div> <script type="text/javascript"> var html = document.querySelector('html') function resize(){
var screneLength = window.innerWidth;
html.style.fontSize = window.innerWidth/7.5 + 'px'
if(screneLength>640&&screneLength<960){
html.className = 'pad'
}else if(screneLength>=960){
html.className = 'pc'
}else{
html.className = 'mobile'
} if(navigator.userAgent.indexOf('Android')!==-1){
html.className = html.className + ' android'
}else if(navigator.userAgent.indexOf('iPhone')!==-1){
html.className = html.className + ' iphone'
}else if(navigator.userAgent.indexOf('iPad')!==-1){
html.className = html.className + ' ipad'
}
}
resize()
window.onresize = function(e){ resize()
}
</script>
</body>
</html>

最新文章

  1. cookie自动登录的实现
  2. 关于JavaScript预编译和执行顺序以及函数引用类型的思考
  3. Linear Algebra lecture9 note
  4. php下载网络图片到服务器
  5. css - float浮动模块的高度问题 解决方案
  6. 没有纳入spring管理的类如何注入spring管理的对象
  7. HBase with MapReduce (MultiTable Read)
  8. MySQL安装图文教程
  9. UI设计师的 Android 备忘录
  10. c# 与 c++ 编译
  11. Android 官方文档:(二)应用清单 —— 2.26 &amp;lt;uses-permission&amp;gt;标签
  12. 17.java.lang.CloneNotSupportedException
  13. SE 2014年4月3日
  14. Box of Bricks
  15. mvc4.0 @Styles.Render(转)
  16. jatoolsprinter html实现每隔几秒获取数据直接后台打印不弹窗
  17. Python之路(第二十九篇) 面向对象进阶:内置方法补充、异常处理
  18. Oracle数据库入门——sql语句和函数详解
  19. oracle查询语句查询增加一列内容
  20. 《图解CSS3:核心技术与案例实战》

热门文章

  1. Scrapy入门操作
  2. Spring 梳理 - filter、interceptor、aop实现与区别 -第一篇
  3. tomcat设定shared lib共享同样的jar
  4. 从零开始搭建WebAPI Core_SqlSugar管理系统 (持续更新中......)
  5. 从零开始入门 K8s | 可观测性:你的应用健康吗?
  6. Spring Boot 2.X(一):入门篇
  7. 解决MVC中Model上的特性在EF框架刷新时清空的问题
  8. SpringBootSecurity学习(24)前后端分离版之OAuth2.0 应用登记
  9. redis等缓存
  10. jquery经常用到的代码段