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 do they transform everything to RTL

    How do I make cards of different heights fill gap in css? [duplicate]

    How do I make a popup contact form exit when clicking the external background div?

    How are URLs handled inside the CSS file in CakePHP so they reference the correct location?

    How to use Auto compiler for less and sass in visual studio

    How to dynamically create a css style rule that is overridable by earlier rules

    How to make rounded corner cut-out using CSS?

    How to position bottom of div above top of its container

    How to align slideshow element below header?

    How do I specify another width for newly added divs in javascript

    How to change CSS class of a HTML page element using ASP.NET?

    How To Add CSS & JavaScript Into Windows Form Application

    I want to add same function for two css class. How can I do it?

    How to convert a jQuery fade effect in CSS?

    How Can I Hide *Only* the Button (Not Entire Element) for the Input Type File in a Django Form? [duplicate]

    How to style a PHP generated label?

    How to fit elements in 100% width without absolute positioning?

    CSS: 2-column table, how to make one column as small as possible but no wrap and the other as big as possible?

    How to put a border on a triangle shape using css?

    How to use particular CSS styles based on screen size / device

    How can I exclude certain elements from css property that has been applied to their parent without using the style attribute

    how to remove space in TR and TD

    How to fix this CSS 3 code to make it working properly on the server?

    How to move CSS classes to the right html elements

    How to set height and width of video element in percent

    How can align these elements?CSS

    How to change elements opacity based on if checkbox is or is not checked with CSS only?

    How to don't effect elements inside an filter-affected element?

    How to do CSS attribute selector with title~= that has to contain a space?

    How to scale down CSS background-image when using various background-positions?