how can a media query detect a full-hd smartphone?


Tags: css,responsive-design,media-queries

Problem :

If a media query checks to see the number of pixels on the device, How does it know between a desktop full hd monitor, and a full hd smartphone?

Obviously the design for both is very different (css-wise)..



Solution :

You do it by pixel density.

@media only screen (-moz-min-device-pixel-ratio: 2), 
only screen and (-o-min-device-pixel-ratio: 2/1), 
only screen and (-webkit-min-device-pixel-ratio: 2), 
only screen and (min-device-pixel-ratio: 2) {
 /*This will be high ppi smart phone*/
}

    CSS Howto..

    How to make CSS menu to open menu in in up direction rather than default down direction

    How can I disable the “Up” arrow via CSS

    How to spread a div to cover available space in a parent container?

    How to align more than one DIVs which list of letters to the center

    how to programmatically call the “click” of css

    How to turn off :hover with CSS?

    How to define a CSS fontface?

    How to combine html, js and css from fiddle

    How to make background images clickable (javascript or css)

    How to make a div grow with its children when inline-blocks don't fit anymore

    how to hide an image on css active in IE

    How to select elements when there is a space in an HTML class

    Coding the slideshow

    in slick slideshow, just want center slide to be active

    How can you assign a class to an id in css or javascript?

    How can I change the css class rules using jQuery?

    How to Identify Microsoft Edge browser via CSS?

    how to increase/decrease font-size from external css [closed]

    How to overlay two fonts with css

    How to prevent HTML code in a literal inside a DIV from affecting outer page styles

    How to change CSS portrait to landscape in iphone?

    CSS: how can I hide a div when its text doesn't fit?

    How can I make a CSS selector for a button with two classes existing in .less?

    How to style textbox using CSS in ASP.NET

    How to make a HTML/CSS/JS iOS style slide transition? [closed]

    CSS how to target 2 attributes?

    How to center li tags list

    How to DRY Sass code using variables?

    Show popup after page load

    How to load CSS on SSL pages?