1, 媒体查询表达式之间还可以用逗号,@media (max-width:800px), print 它表示或的意思 @media (max-width: 800px) OR print; 2, not 是对整个表达式的否定 @media not all and (min-width: 765px), 相当于 @media not (all and (min-width: 765px)) 如果不想这样的做,可以用,进行分割,@media not all, min-width:765px 3,…
var result = window.matchMedia('(max-width: 700px)'); if (result.matches) { console.log('页面宽度小于等于700px'); } else { console.log('页面宽度大于700px'); } window.matchMedia方法返回的MediaQueryList对象有两个方法,用来监听事件:addListener方法和removeListener方法.如果mediaQuery查询结果发生变化,就调…
In CSS media the difference between width and device-width can be a bit muddled, so lets expound on that a bit. device-width refers to the width of the device itself, in other words, the screen resolution of the device. Lets say your screen's resolut…
媒体查询语法: 1.内联写法:and之后必须有空格@media screen and (min-width:960px //判断浏览器大小条件){body{background:red} //常规的样式} 2.外联写法:当满足屏幕满足条件的时候连接href后的css文件<link='stylesheet' media='screen and (min-width:960)' href='xx.css'/><link='stylesheet' media='screen and (min-…