CSS如何判断横屏竖屏

竖屏引用

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

html5横屏显示HTML5在移动端若何断定阅读器是横屏照样竖屏 Node.js
(图片来自网络侵删)