Html 媒体=全部 vs 媒体=屏幕

声明:本页面是StackOverFlow热门问题的中英对照翻译,遵循CC BY-SA 4.0协议,如果您需要使用它,必须同样遵循CC BY-SA许可,注明原文地址和作者信息,同时你必须将它归于原作者(不是我):StackOverFlow 原文地址: http://stackoverflow.com/questions/12549267/
Warning: these are provided under cc-by-sa 4.0 license. You are free to use/share it, But you must attribute it to the original authors (not me): StackOverFlow

提示:将鼠标放在中文语句上可以显示对应的英文。显示中英文
时间:2020-08-29 02:59:04  来源:igfitidea点击:

Media=All vs Media=Screen

htmlcssmedia-queries

提问by L84

It seems like recently I have seen many more people starting to use media="all"vs media="screen"in their stylesheets.

似乎最近我看到更多的人开始在他们的样式表中使用media="all"vs。media="screen"

My question is when should I use media="all"over media="screen"and vice versa?

我的问题是我什么时候应该使用media="all"over media="screen",反之亦然?

Note: I am using HTML5 Doctype if that makes a difference.

注意:如果这有所不同,我将使用 HTML5 Doctype。

回答by NullPoiиteя

media="all"    // Used for all media type devices ( its default under html 5)
media="screen" // Used for computer screens(default value  for html 4.01)

Good read

好读

7.3 Recognized media types
Is there no difference between No media and media=“all” in css link?

7.3 可识别的媒体类型
css链接中的No media和media="all"有没有区别?

回答by kittu

According to W3C Spec:

根据W3C 规范

7.3 Recognized media types

7.3 可识别的媒体类型

The names chosen for CSS media types reflect target devices for which the relevant properties make sense. In the following list of CSS media types the names of media types are normative, but the descriptions are informative. Likewise, the "Media" field in the description of each property is informative.

为 CSS 媒体类型选择的名称反映了相关属性对其有意义的目标设备。在下面的 CSS 媒体类型列表中,媒体类型的名称是规范的,但描述是信息性的。同样,每个属性描述中的“媒体”字段都是信息性的。

all

全部

Suitable for all devices.

适用于所有设备。

braille

盲文

Intended for braille tactile feedback devices.

用于盲文触觉反馈设备。

embossed

压花

Intended for paged braille printers.

适用于分页盲文打印机。

handheld

手持式

Intended for handheld devices (typically small screen, limited bandwidth).

适用于手持设备(通常是小屏幕、有限带宽)。

print

打印

Intended for paged material and for documents viewed on screen in print preview mode. Please consult the section on paged media for information about formatting issues that are specific to paged media.

适用于分页材料和在打印预览模式下在屏幕上查看的文档。有关特定于分页媒体的格式问题的信息,请参阅分页媒体部分。

projection

投影

Intended for projected presentations, for example projectors. Please consult the section on paged media for information about formatting issues that are specific to paged media.

用于投影演示,例如投影仪。有关特定于分页媒体的格式问题的信息,请参阅分页媒体部分。

screen

屏幕

Intended primarily for color computer screens.

主要用于彩色计算机屏幕。

speech

演讲

Intended for speech synthesizers. Note: CSS2 had a similar media type called 'aural' for this purpose. See the appendix on aural style sheets for details.

适用于语音合成器。注意:为此,CSS2 有一个类似的媒体类型,称为“aural”。有关详细信息,请参阅听觉样式表的附录。

tty

打字机

Intended for media using a fixed-pitch character grid (such as teletypes, terminals, or portable devices with limited display capabilities). Authors should not use pixel units with the "tty" media type.

适用于使用固定间距字符网格的媒体(例如电传打字机、终端或显示能力有限的便携式设备)。作者不应将像素单位与“tty”媒体类型一起使用。

tv

电视

Intended for television-type devices (low resolution, color, limited-scrollability screens, sound available).

适用于电视类型设备(低分辨率、彩色、有限滚动屏幕、可用声音)。