WEB DEVELOPER SITE
HTMLCSSJAVASCRIPTSQLPHPBOOTSTRAPJQUERYANGULARXML
×

CSS Reference

CSS Reference CSS Selectors CSS Functions CSS Reference Aural CSS Web Safe Fonts CSS Animatable CSS Units CSS PX-EM Converter CSS Colors CSS Color Values CSS3 Browser Support

CSS Properties

align-content align-items align-self all animation animation-delay animation-direction animation-duration animation-fill-mode animation-iteration-count animation-name animation-play-state animation-timing-function backface-visibility background background-attachment background-blend-mode background-clip background-color background-image background-origin background-position background-repeat background-size border border-bottom border-bottom-color border-bottom-left-radius border-bottom-right-radius border-bottom-style border-bottom-width border-collapse border-color border-image border-image-outset border-image-repeat border-image-slice border-image-source border-image-width border-left border-left-color border-left-style border-left-width border-radius border-right border-right-color border-right-style border-right-width border-spacing border-style border-top border-top-color border-top-left-radius border-top-right-radius border-top-style border-top-width border-width bottom box-shadow box-sizing caption-side clear clip color column-count column-fill column-gap column-rule column-rule-color column-rule-style column-rule-width column-span column-width columns content counter-increment counter-reset cursor direction display empty-cells filter flex flex-basis flex-direction flex-flow flex-grow flex-shrink flex-wrap float font @font-face font-family font-size font-size-adjust font-stretch font-style font-variant font-weight hanging-punctuation height justify-content @keyframes left letter-spacing line-height list-style list-style-image list-style-position list-style-type margin margin-bottom margin-left margin-right margin-top max-height max-width @media min-height min-width nav-down nav-index nav-left nav-right nav-up opacity order outline outline-color outline-offset outline-style outline-width overflow overflow-x overflow-y padding padding-bottom padding-left padding-right padding-top page-break-after page-break-before page-break-inside perspective perspective-origin position quotes resize right tab-size table-layout text-align text-align-last text-decoration text-decoration-color text-decoration-line text-decoration-style text-indent text-justify text-overflow text-shadow text-transform top transform transform-origin transform-style transition transition-delay transition-duration transition-property transition-timing-function unicode-bidi vertical-align visibility white-space width word-break word-spacing word-wrap z-index



 

CSS3 @media Rule

Example

Change the foundation shading if the viewport is 480 pixels wide or wider:

@media screen and (min-width: 490px) {
    body {
        foundation shading: lightgreen;
    }
}

Definition and Usage

The @media rule is utilized to characterize distinctive style rules for various media types/devices.

In CSS2 this was called media types, while in CSS3 it is called media questions.

Media questions take a gander at the capacity of the gadget, and can be utilized to check numerous things, such as:

  • width and tallness of the viewport
  • width and tallness of the device
  • orientation (is the tablet/telephone in scene or representation mode?)
  • resolution
  • and much more

Browser Support

The numbers in the table determines the primary program form that completely underpins the @media rule.

Property
@media 21 12 9 3.5 4.0 9

CSS Syntax

@media not|only mediatype and (media feature) {
    CSS-Code;
}

You can likewise have distinctive stylesheets for various media:

<link rel="stylesheet" media="mediatype and|not|only (media feature)" href="mystylesheet.css">

Media Types

Value Description
all Used for all media type devices
aural Deprecated. Used for discourse and sound synthesizers
braille Deprecated. Used for braille material input devices
embossed Deprecated. Used for paged braille printers
handheld Deprecated. Used for little or handheld devices
print Used for printers
projection Deprecated. Used for anticipated introductions, as slides
screen Used for PC screens, tablets, advanced cells etc.
speech Used for screenreaders that "reads" the page out loud
tty Deprecated. Used for media utilizing a fixed-pitch character network, as prints and terminals
tv Deprecated. Used for TV type devices

Media Features

Value Description
aspect-ratio The proportion between the width and the tallness of the viewport
color The number of bits per shading part for the yield device
color-index The number of hues the gadget can display
device-angle ratio The proportion between the width and the tallness of the device
device-height The tallness of the gadget, for example, a PC screen
device-width The width of the gadget, for example, a PC screen
grid Whether the gadget is a matrix or bitmap
height The viewport height
max-angle ratio The most extreme proportion between the width and the tallness of the show area
max-color The most extreme number of bits per shading part for the yield device
max-shading index The most extreme number of hues the gadget can display
max-gadget angle ratio The most extreme proportion between the width and the tallness of the device
max-gadget height The most extreme tallness of the gadget, for example, a PC screen
max-gadget width The most extreme width of the gadget, for example, a PC screen
max-height The most extreme tallness of the presentation region, for example, a program window
max-monochrome The most extreme number of bits per "shading" on a monochrome (greyscale) device
max-resolution The most extreme goals of the gadget, utilizing dpi or dpcm
max-width The most extreme width of the showcase territory, for example, a program window
min-viewpoint ratio The least proportion between the width and the stature of the show area
min-color The least number of bits per shading segment for the yield device
min-shading index The least number of hues the gadget can display
min-gadget viewpoint ratio The least proportion between the width and the stature of the device
min-gadget width The least width of the gadget, for example, a PC screen
min-gadget height The least stature of the gadget, for example, a PC screen
min-height The least stature of the presentation territory, for example, a program window
min-monochrome The least number of bits per "shading" on a monochrome (greyscale) device
min-resolution The least goals of the gadget, utilizing dpi or dpcm
min-width The least width of the presentation territory, for example, a program window
monochrome The number of bits per "shading" on a monochrome (greyscale) device
orientation The introduction of the viewport (scene or picture mode)
overflow-block How does the yield gadget handle content that floods the viewport along the square pivot (included Media Queries Level 4)
overflow-inline Can content that floods the viewport along the inline pivot be looked over (included Media Queries Level 4)
resolution The goals of the yield gadget, utilizing dpi or dpcm
scan The checking procedure of the yield device
update-frequency How rapidly can the yield gadget adjust the presence of the substance (included Media Queries Level 4)
width The viewport width

Example

Use the @media principle to make responsive design:

@media just screen and (max-width: 400px) {
    .gridmenu {
        width:105%;
    }

    .gridmain {
        width:105%;
    }

    .gridright {
        width:105%;
    }
}