CSS如何判断横屏竖屏

竖屏引用

html5默认横屏HTML5在移动端若何断定阅读器是横屏照样竖屏 NoSQL

<link rel=\公众stylesheet\公众 media=\"大众all and (orientation:portrait)\公众 href=\"大众portrait.css\"大众> 横屏引用

<link rel=\公众stylesheet\"大众 media=\"大众all and (orientation:landscape)\公众 href=\"大众landscape.css\"大众> css代码

@media screen and (orientation: portrait) { /竖屏 css/ } @media screen and (orientation: landscape) { /横屏 css/ } JS判断横屏竖屏方法

//判断手机横竖屏状态: window.addEventListener(\"大众onorientationchange\"大众 in window ? \"大众orientationchange\"大众 : \"大众resize\公众, function() { if (window.orientation === 180 || window.orientation === 0) { alert('竖屏状态!
'); } if (window.orientation === 90 || window.orientation === -90 ){ alert('横屏状态!
'); } }, false);