¶各メディア向けスタイルシートの指定。
[only | not]? 媒体型? [ [not | and | or] 媒体条件]?
@media print,screen{ BODY{ margin:0; font-size:10pt; } }
[only | not]?
only
not
all
print
screen
not | and | or
not
and
or
例えば (update: slow) or (hover: none) は、[スクリーンの更新が遅い(電子書籍リーダなど)]または[首ポインタ指示装置が hover 能力を有さない]ときに合致する ― おそらく、利用者が hover するまで小さくたたんでおくようなレイアウトに代えて、当初から より多く情報を表示するレイアウトを利用するべきであることを指示する。
複数個の媒体条件を丸括弧 ( ) で括ってグループ化すれば、単独の媒体クエリと同じように、条件の中に入れ子にできる。
例えば (not (color)) or (hover) は、単彩色または hover 能力を有する装置に対し、真 になる。
単彩色、かつ hover 能力を有さない装置をクエリしたいと求めるならば、代わりに not ((color) or (hover)) と記さなければならない(あるいは、(not (color)) and (not (hover))) でも等価になる)。
screenとprintに対応させる:
@media screen, print { body { line-height: 1.2; } }
@media (height > 600px) { body { line-height: 1.4; } }
↑¶[Edge]でできない。
@media (400px <= width <= 700px) { body { line-height: 1.4; } }
表示内容: |
表示内容: |