天天看點

如何為CSS指定對應的Media typemedia group和media type的關系

One of the most important features of style sheets is that they specify how a document is to be presented on different media: on the screen, on paper, with a speech synthesizer, with a braille device(盲人使用的裝置上), etc.

style sheet設定的目的,是為了描述文檔如何在不同的media類型上呈現的。

Certain CSS properties are only designed for certain media (e.g., the ‘page-break-before’ property only applies to paged media).

某些 CSS property 隻有在應用于某些 media 上時才有意義,比如page-break-before 屬性隻能應用在paged media上。

occasion, however, style sheets for different media types may share a property, but require different values for that property.

不同media類型上的style sheet可能共享同名property,但是值有所不同。

For example, the ‘font-size’ property is useful both for screen and print media. The two media types are different enough to require different values for the common property; a document will typically need a larger font on a computer screen than on paper.

比如 font-size,在screen和print media上都有效,但是值不同。

Therefore, it is necessary to express that a style sheet, or a section of a style sheet, applies to certain media types.

是以,我們使用style sheet時,至少需要為其某一部分指定适配的media type.

具體文法:

如何為CSS指定對應的Media typemedia group和media type的關系

media group和media type的關系

如何為CSS指定對應的Media typemedia group和media type的關系

SAP Spartacus裡使用media type @media的例子:

如何為CSS指定對應的Media typemedia group和media type的關系