⌚ CSS3 Essentials
- Optional media type + any number of media feature expression with logical operator.
- Media queries are use only when site or applications modification is required.
- Media queries types
- Device's general type or specific character.
- Parameters (such as screen resolution and browser viewport width).
- Result is true/false.
- Syntax: @media not|only mediatype and (expressions) { ... }
- Media types
- Describe the general category of a device
- But device category not describe when use not or only logical operators.
- all
- For all devices. Default.
- Print devices or preview mode.
- screen
- For device screen.
- @media screen and (min-width: 40px) { p { background-color: lightgreen; }}
- speech
- Synthesize for speech.
- Logical Operators
- If use not or only then media type is required.
- 'and' and comma(,) both are same but 'and' returns true only when all conditions are true.
- Media features
- Specific characteristic for output device or listener.
- Media features only when it's presence and its case-sensitive.
- Range value: min-* or max-*.
- width
- Specify the width length value of the viewport. Using width, max-width or min-width.
- @media (width: 360px) { div { color: red; }}
- height
- Specify the height length value of the viewport. Using height, max-height or min-height.
- @media (min-height: 25rem) { div { background: yellow; }}
- aspect-ratio
- Ratio value depend on width-to-height aspect ratio of the viewport.
- @media (aspect-ratio: 1/1) { div { color: red; }}
- @media(min-aspect-ratio: 8/4) { div { background: yellow; }}
- orientation
- Test the orientation of the view port.
- @media screen and (orientation: landscape) { body { ... }}
- resolution
- Test the pixel density of the output device. Accept range value (min/max).
- @media(resolution: 155dpi) { p { width:12px; }}
- @media(min-resolution: 27dpi) { p { text-decoration: underline; }}
- @media(max-resolution: 30dpi) { p { background: #000; }}
- scan
- Image displayed on television screen or other devices. Not like traditional scanning.
- interlace
- The device draws odd lines and even lines alternately. Some televisions use interlaced scanning. [Ref[1]]
- progressive
The device draws all lines in sequence. All computer screens use progressive scanning.[Ref[1]]
- @media (scan: progressive) { h1 { font-family: serif; } }
- grid
- Bitmap-based screens.
- Ref:
This is an extraordinary rundown to use later on..
ReplyDeletecss beautifier