- Smart Phone
- Tablet
- Laptop
- Monitor
- TV
- Wrist Watch
<link rel='stylesheet' media='screen and (min-width: 320px) and (max-width: 480px)'
href='css/smartphone.css' />
@media screen and (max-width: 480px){ selector { /* small screen */ property: value; } } @media screen and (orientation: landscape) { selector { /* landscape properties */ property: value; } } @media screen and (-webkit-min-device-pixel-ratio: 1.5) { selector { /* properties for higher resolution screens */ property: value; } }
Supported in Webkit Browsers
-webkit-min-device-pixel-ratio: 2
Firefox up to FF 16
min--moz-device-pixel-ratio: 2
The standard way
min-resolution: 2dppx
dppx fallback
min-resolution: 192dpi
"only" leaves out older browsers
media="only print and (color)"
"and" - both parts must be true
media="only screen and (orientation: portrait)"
"not" - if untrue
media="not screen and (color)"
Comma separates selectors - any part can be true
media="print, screen and (min-width: 480px)"
@media screen and (-webkit-min-device-pixel-ratio: 2) { .iphone4 { /* high DPI */} }
@media screen and (transform-3d) { .transforms {} }
@media screen and (min-width: 320px) and (max-width: 500px){ @-ms-viewport { width: device-width;} }
Also works with (-prefix-animation)
and (-prefix-transition)
<meta name="viewport" content="width=device-width, initial-scale=1, maximum-scale=1"/>
device-width
(width of screen)device-height
(height of screen)@viewport { width: device-width; zoom: 0.5; }
@media screen and (max-width:400px) { @-ms-viewport { width:320px; // or device-width;} }
If <meta> is set to disable zoom, in Chrome and Firefox there is no delay on onClick events.
Tap Highlight Color
-webkit-tap-highlight-color: #bada55;
Prevent Select & Hold dialogue
-webkit-user-select: none;
Prevent Images Dialog
-webkit-touch-callout: none;
Prevent accidental OS popups (panning)
-ms-touch-action: none;
column-count: 1; column-width: 10em; column-rule: 1px solid #bbb; column-gap: 2em;
Adipisicing rump nostrud exercitation turkey, bresaola deserunt ullamco beef ribs pork loin ball tip pig pork belly nisi. Cillum sunt officia deserunt, beef aliqua ham ut t-bone sed ut consequat shoulder. Nostrud excepteur biltong non, fatback salami incididunt beef cupidatat occaecat.
Reprehenderit ham hock labore tri-tip chuck, excepteur ut. Meatball sint enim beef ribs, mollit laborum flank commodo fatback pariatur tail rump eiusmod spare ribs dolore. Ut minim qui, tongue eu short ribs pancetta excepteur incididunt culpa consequat pastrami magna chuck. Flank sunt sint, occaecat ut adipisicing labore turkey laboris in magna.
Chicken bacon meatloaf minim meatball salami sunt spare ribs.
Bacon sed tail, pork loin pariatur meatloaf hamburger exercitation corned beef shank ex esse sirloin qui beef ribs. Consectetur anim corned beef, cupidatat ex enim tempor. Pariatur consectetur ad, enim ut quis consequat aliquip exercitation jowl tenderloin ham dolore.
Fugiat excepteur aliqua, cow dolor swine shoulder elit tri-tip shankle. Irure consectetur cow labore, cupidatat exercitation ea jerky ham officia dolore tongue eu aliqua. Ham hock irure beef ribs non, flank sausage eiusmod ham short loin nostrud.
Prefix -webkit & -moz. Supported since IE 10, O 11.1, all webkit, all FF