語法
shape 離散特性被指定為兩個可接受的字串之一:rect 表示矩形螢幕,或 round 表示圓形、橢圓形或近似橢圓形的螢幕。
示例
基本示例
HTML
html
<h1>Hello World!</h1>
CSS
css
h1 {
text-align: left;
}
@media (shape: rect) {
h1 {
text-align: left;
}
}
@media (shape: round) {
h1 {
text-align: center;
}
}
自定義樣式表
此 HTML 將為具有圓形螢幕的裝置應用特殊樣式表。
html
<head>
<link rel="stylesheet" href="default.css" />
<link
media="screen and (shape: rect)"
rel="stylesheet"
href="rectangle.css" />
<link media="screen and (shape: round)" rel="stylesheet" href="round.css" />
</head>
規範
| 規範 |
|---|
| CSS Round Display Level 1 # shape 媒體特性 |
瀏覽器相容性
目前沒有瀏覽器支援此功能。