メディア
デバイス
スクリーンショット、動画、動作するデモを囲むスマートフォンの筐体です。
このページの内容
デバイスは、スクリーンショット、動画、動作するデモを囲むスマートフォンの筐体です。粘土を型に入れて作った模型のように、一段高くなった板状の本体、細いベゼル、画面上部のカメラ位置にある小さな凹部を、ひとつの素材でできているように描きます。デスクトップ向けのウィンドウと同様に、フレームの形でスマートフォンだと伝え、色はすべて表示するコンテンツに委ねます。
デバイス
<div class="device" style="--device-width: 13.5rem"> <img class="device-screen" src="/demo/moonstone.svg" alt="A pale stone over grey hills"></div><div className="device" style={{ '--device-width': '13.5rem' } as React.CSSProperties}> <img className="device-screen" src="/demo/moonstone.svg" alt="A pale stone over grey hills" /></div><div class="device" style="--device-width: 13.5rem"> <img class="device-screen" src="/demo/moonstone.svg" alt="A pale stone over grey hills"></div><template> <div class="device" style="--device-width: 13.5rem"> <img class="device-screen" src="/demo/moonstone.svg" alt="A pale stone over grey hills"> </div></template>#画面
device-screenは、画面に表示する<img>、<video>、<iframe>、またはマークアップのブロックに指定します。コンテンツはベゼルの内側いっぱいに広がり、画像は画面に合わせて切り抜かれます。画面の角丸の半径は本体の角丸の半径からベゼルの幅を引いた値で、角でも間隔が一定になります。
マークアップで画面を作る場合は、実機のステータスバーと同じように、画面上部に本体幅の約6分の1の余白を取り、カメラ用の凹部より下にコンテンツを配置します。
マークアップで作る画面
<div class="device" style="--device-width: 13.5rem"> <div class="device-screen bg-surface-base flex flex-col gap-sm px(14) pt(44) pb(14)"> <p class="eyebrow">Wednesday</p> <p class="heading heading-lg">Today</p> <ul class="checklist mt(4)"> <li class="checklist-item"> <label class="checklist-label"> <input class="checkbox" type="checkbox" checked><span class="checklist-title">Review the contract</span> </label> </li> <li class="checklist-item"> <label class="checklist-label"> <input class="checkbox" type="checkbox"><span class="checklist-title">Call Grace at three</span> </label> </li> <li class="checklist-item"> <label class="checklist-label"> <input class="checkbox" type="checkbox"><span class="checklist-title">Book the flight</span> </label> </li> </ul> </div></div><div className="device" style={{ '--device-width': '13.5rem' } as React.CSSProperties}> <div className="device-screen bg-surface-base flex flex-col gap-sm px(14) pt(44) pb(14)"> <p className="eyebrow">Wednesday</p> <p className="heading heading-lg">Today</p> <ul className="checklist mt(4)"> <li className="checklist-item"> <label className="checklist-label"> <input className="checkbox" type="checkbox" defaultChecked /><span className="checklist-title">Review the contract</span> </label> </li> <li className="checklist-item"> <label className="checklist-label"> <input className="checkbox" type="checkbox" /><span className="checklist-title">Call Grace at three</span> </label> </li> <li className="checklist-item"> <label className="checklist-label"> <input className="checkbox" type="checkbox" /><span className="checklist-title">Book the flight</span> </label> </li> </ul> </div></div><div class="device" style="--device-width: 13.5rem"> <div class="device-screen bg-surface-base flex flex-col gap-sm px(14) pt(44) pb(14)"> <p class="eyebrow">Wednesday</p> <p class="heading heading-lg">Today</p> <ul class="checklist mt(4)"> <li class="checklist-item"> <label class="checklist-label"> <input class="checkbox" type="checkbox" checked><span class="checklist-title">Review the contract</span> </label> </li> <li class="checklist-item"> <label class="checklist-label"> <input class="checkbox" type="checkbox"><span class="checklist-title">Call Grace at three</span> </label> </li> <li class="checklist-item"> <label class="checklist-label"> <input class="checkbox" type="checkbox"><span class="checklist-title">Book the flight</span> </label> </li> </ul> </div></div><template> <div class="device" style="--device-width: 13.5rem"> <div class="device-screen bg-surface-base flex flex-col gap-sm px(14) pt(44) pb(14)"> <p class="eyebrow">Wednesday</p> <p class="heading heading-lg">Today</p> <ul class="checklist mt(4)"> <li class="checklist-item"> <label class="checklist-label"> <input class="checkbox" type="checkbox" checked><span class="checklist-title">Review the contract</span> </label> </li> <li class="checklist-item"> <label class="checklist-label"> <input class="checkbox" type="checkbox"><span class="checklist-title">Call Grace at three</span> </label> </li> <li class="checklist-item"> <label class="checklist-label"> <input class="checkbox" type="checkbox"><span class="checklist-title">Book the flight</span> </label> </li> </ul> </div> </div></template>#サイズ
本体の既定幅は280pxで、幅と高さの比率は9:19.5です。サイズ変更には幅の直接指定ではなく、--device-widthを使います。角丸の半径はその値の14%、ベゼルの幅は3%なので、サイズを変えても形状が保たれます。旧型のスマートフォンや小型タブレットを表現するには、--device-ratioで縦横比を変えます。側面ボタンは本体から2px突き出し、要素の幅にはその分が左右に含まれるため、スクロール領域の端に置いてもスクロール範囲は広がりません。
サイズのバリエーション
<div class="device" style="--device-width: 7rem"> <img class="device-screen" src="/demo/moonstone.svg" alt></div><div class="device" style="--device-width: 9rem"> <img class="device-screen" src="/demo/moonstone.svg" alt></div><div class="device" style="--device-width: 11rem; --device-ratio: 3 / 4"> <img class="device-screen" src="/demo/moonstone.svg" alt></div><> <div className="device" style={{ '--device-width': '7rem' } as React.CSSProperties}> <img className="device-screen" src="/demo/moonstone.svg" alt="" /> </div> <div className="device" style={{ '--device-width': '9rem' } as React.CSSProperties}> <img className="device-screen" src="/demo/moonstone.svg" alt="" /> </div> <div className="device" style={{ '--device-width': '11rem', '--device-ratio': '3 / 4' } as React.CSSProperties}> <img className="device-screen" src="/demo/moonstone.svg" alt="" /> </div></><div class="device" style="--device-width: 7rem"> <img class="device-screen" src="/demo/moonstone.svg" alt></div><div class="device" style="--device-width: 9rem"> <img class="device-screen" src="/demo/moonstone.svg" alt></div><div class="device" style="--device-width: 11rem; --device-ratio: 3 / 4"> <img class="device-screen" src="/demo/moonstone.svg" alt></div><template> <div class="device" style="--device-width: 7rem"> <img class="device-screen" src="/demo/moonstone.svg" alt> </div> <div class="device" style="--device-width: 9rem"> <img class="device-screen" src="/demo/moonstone.svg" alt> </div> <div class="device" style="--device-width: 11rem; --device-ratio: 3 / 4"> <img class="device-screen" src="/demo/moonstone.svg" alt> </div></template>#アクセシビリティ
- フレームは装飾なので読み上げられません。画面に意味があるため、画像には表示されているインターフェースの内容を伝える
altを指定します。隣のテキストですでに説明している場合は、空のaltを指定します。 - 画面内で動作するデモは、小さな実際のページです。操作対象はタッチ操作に十分な大きさを確保し、キーボードで操作できるようにするか、キーボード操作の対象から外します。
- 強制カラーモードでは、本体とカメラ用の凹部にシステムカラーのアウトラインが付きます。
- 画面内で自動再生する録画は音声なしにします。音声や操作の手順で内容を伝える録画には、キャプションやテキストによる説明も必要です。
#クラス
| クラス | 説明 |
|---|---|
device | 筐体は幅 280px、幅と高さの比が 9 対 19.5 の浮き上がったシートで、細いベゼル、カメラのくぼみ、側面ボタンを備えます。ボタンは筐体から 2px 突き出しますが、要素自体のボックス内に収まり、ボックスの外側には何も描画されません。 |
device-screen | 画像、動画、フレーム、またはマークアップのブロックに適用します。画面はベゼルの内側いっぱいに広がり、画面と筐体の角丸は中心を共有します。 |
#カスタムプロパティ
| プロパティ | 既定値 | 説明 |
|---|---|---|
--device-width | 17.5rem | 筐体の幅。角丸とベゼルの寸法はこの幅を基準に算出 |
--device-ratio | 9 / 19.5 | 筐体の縦横比 |
--device-radius | calc(var(--device-width) * .14) | 筐体の角を円弧で丸める半径 |
--device-bezel | calc(var(--device-width) * .03) | 画面を囲む枠の幅 |