Firefox OS Media Query

By  on  

Firefox OS is an awesome new HTML5-based mobile operating system.  Some would says it's epic, I just think it's...super epic.   The "native" languages are HTML, CSS, and JavaScript -- it's enough to make a Web Developer weep.  Anyways, it's important to know how to target currently released Firefox OS devices with CSS media queries.  Here's how!

The CSS

The Firefox OS base media query (for popular released devices) is actually that of a common small mobile phone:

@media only screen and (min-device-width : 320px) and (max-device-width : 480px) {
	
	/* styles go here */
	
}

This media query accommodates for both landscape and portrait views of released Firefox OS devices.

As Firefox OS is ported to watches, tablets, and other devices, you'll need to keep accommodating other media queries, as you should already.  Keep in mind that Firefox OS doesn't have set dimensions, but this will cover to released phones to this point.

Recent Features

Incredible Demos

  • By
    Adding Events to Adding Events in MooTools

    Note: This post has been updated. One of my huge web peeves is when an element has click events attached to it but the element doesn't sport the "pointer" cursor. I mean how the hell is the user supposed to know they can/should click on...

  • By
    MooTools Overlay Plugin

    Overlays have become a big part of modern websites; we can probably attribute that to the numerous lightboxes that use them. I've found a ton of overlay code snippets out there but none of them satisfy my taste in code. Many of them are...

Discussion

  1. But why *would* you target Firefox OS? It seems to me that the best approach is to build a web app that works great across all viewport widths. It’s useful to know which MQ widths are currently used on Firefox OS devices, but hard-coding it into the CSS? I don’t know.

    • Yes, building a site that looks good everywhere is still the key, but knowing the media query that targets those devices is still important. :)

Wrap your code in <pre class="{language}"></pre> tags, link to a GitHub gist, JSFiddle fiddle, or CodePen pen to embed!