CSS

方向 | @viewport.orientation

@viewport.orientation

orientationCSS描述符控制由@viewport所定义的文档的方向。

/* Keyword values */ orientation: auto; orientation: portrait; orientation: landscape;

对于倾斜设备时改变方向的UA /设备,作者可以使用此描述符来禁止方向更改。

Related at-rule@viewport
初始值auto
百分比值refer to the size of bounding box
适用媒体visual, continuous
计算值as specified
规范顺序the unique non-ambiguous order defined by the formal grammar

语法

auto用户代理将自动设置文档的方向,通常基于由加速度计(如果设备具有这样的硬件传感器)确定的设备的方向,尽管经常有用户控制的OS级“锁定方向”设置将超过加速计读数。

正式语法

auto | portrait | landscape

规范

SpecificationStatusComment
CSS Device AdaptationThe definition of '"orientation" descriptor' in that specification.Working DraftInitial definition

浏览器兼容性

FeatureChromeFirefox (Gecko)Internet ExplorerOperaSafari
Basic supportNo supportNo support10 -msNo support?

FeatureAndroidChrome for AndroidFirefox Mobile (Gecko)IE MobileOpera MobileSafari Mobile
Basic support????8 -o?