0

I'm creating responsive web app for desktop and mobile devices. My problem is I don't know when I need to use *-device-width. Pls explain usecases for *-device-width. Why should I use it instead of *-width?

fedor.belov
  • 22,343
  • 26
  • 89
  • 134
  • Pls lrn hw 2 wrt proper English ... it makes dealing with you much easier for others. – Joey Jul 18 '12 at 14:17
  • This is an exact duplicate of http://stackoverflow.com/questions/5716066/difference-between-width-and-device-width-in-css-media-queries – imakeitpretty Jul 18 '12 at 15:53
  • Additional explanation in this question: http://stackoverflow.com/questions/8305409/why-use-device-width – imakeitpretty Jul 18 '12 at 16:19

2 Answers2

1

You use it with a meta tag, which you will add to your head tag

<meta name="viewport" content="width=device-width" />
DOCbrand
  • 339
  • 1
  • 6
  • What does this have to do with media queries? – BoltClock Jul 18 '12 at 14:23
  • The [viewport media tag](https://developer.mozilla.org/en/Mobile/Viewport_meta_tag/) is not a [media query](https://developer.mozilla.org/en/CSS/Media_queries/). – Rob W Jul 18 '12 at 14:24
0

From Difference between width and device-width in CSS media queries:

device-width is the...

width of the output device (meaning the entire screen or page, rather than just the rendering area, such as the document window).

Source.

The width...

describes the width of the rendering surface of the output device (such as the width of the document window, or the width of the page box on a printer)

Source.

Community
  • 1
  • 1
imakeitpretty
  • 2,108
  • 5
  • 16
  • 16
  • Thanks but you haven't answer my question. Why should I use *-device-width instead of *-width? – fedor.belov Jul 18 '12 at 16:12
  • There is a good explanation of this about halfway down this [page](http://www.elated.com/articles/responsive-web-design-demystified/) – imakeitpretty Jul 18 '12 at 16:17
  • Copy-pasting others' answers is plagiarism. Don't forget to give credits to the original author, eg by adding a link to the original post. – Rob W Jul 19 '12 at 08:23
  • Sorry, I posted the original link in the comments above. I was just trying to make it so that they didn't have to hunt, didn't occur to me to repost the link. my bad. – imakeitpretty Jul 19 '12 at 13:53