r/javascript • • Aug 21 '18

Effectively supported in all browsers, JavaScript has its own form of media queries just like CSS.

https://developer.mozilla.org/en-US/docs/Web/API/Window/matchMedia
465 Upvotes

114 comments sorted by

View all comments

-34

u/StoneCypher Aug 21 '18

um, this actually is css, not javascript

0

u/[deleted] Aug 21 '18

[deleted]

-33

u/StoneCypher Aug 21 '18

Seems to work as expected

<html><head><style type="text/css">
  @media (min-width: 400px) { body { background-color: green; } }
  @media (max-width: 399px) { body { background-color: red; } }
</style></head><body>
  <p>hiya</p>
</body></html>

0

u/[deleted] Aug 22 '18

[deleted]

-2

u/StoneCypher Aug 22 '18

No. You said to try it in css, so I did, and it works, because it is css.

Afterwards, the reddit rage squad came to tell me that it hopes I'm not a programmer, because this js interface to css is useful in js.

0

u/[deleted] Aug 22 '18

[deleted]

0

u/StoneCypher Aug 22 '18

CSS in a style block is the same as CSS in an external file, other than timing issues

For clarity, I do understand that you are talking about the call interface, and that I am talking about what it calls

0

u/[deleted] Aug 22 '18

[deleted]

0

u/StoneCypher Aug 22 '18

For clarity, I do understand that you are talking about the call interface, and that I am talking about what it calls

I’m not convinced we’re talking about the same thing here.

good thing it's been such a friendly discussion this entire time, huh

.

What may be tripping you up

i'm really not interested in watching you repeat yourself in progressively more condescending tones.

.

I’m not sure what your angle is

i know.

.

just picking this incorrect argument as your reddit hill to die on.

i think you've wildly overestimated the importance of you yelling at people on reddit.

i think i'll stop responding. i seem to be just encouraging you to escalate