Developers › ODIN blog

The State of Vertical Range Inputs (as of Nov 2012)

November 30, 2012 · by Mike Taylor

Yesterday I found myself needing to write a silly demo to sketch out some code (to be used in a larger project). The idea was to dump a ton of <input type=range> elements on a page, alternate between horizontal and vertical orientations, and manipulate the value property in various magical ways.

The default rendering of type=range is a horizontal slider widget. To see it yourself quickly, put the following in your browser URL bar:

data:text/html, <input type="range">

There's a catch though — not all browsers support this yet. But we're really, really close, especially with an implementation in progress for Firefox (Microsoft beating Mozilla? End of days, etc.).

So how do you get a vertical range slider? The HTML Standard mentions "determin[ing] the orientation of the control from the ratio of the style-sheet-specified height and width properties." So as long as you define the width to be smaller than the height, your browser should create a vertical range input for you.

You can see if this works in your browser right now.

Unfortunately, Opera is still the only browser to support this out of the box. Webkit-based browsers can get by with the -webkit-appearance: slider-vertical non-standard CSS, but that doesn't help Firefox or IE10.

But what about Firefox? Luckily there's a handful of polyfills out there. You'll just have to let me know if anyone of them enable vertical ranges, and will work for IE10!

So the good news is that we're really close to all modern browsers supporting <input type=range>. And the less good news is that native vertical ones need more time. It's time to tweak my silly demo.

Readers' comments 16

Left under the original article, as archived.

  • Mike TaylorFriday, November 30, 2012 5:37:08 PM

    Of course, CSS transforms might be a solution for you, depending on what you're trying to do.
  • QuHnoFriday, November 30, 2012 6:28:58 PM

    Vertical sliders are still not supported by every modern browser? :bigeyes:

    I can't remember when I started experimenting with them.
    http://quhno.internetstrahlen.de/myopera/extensions/colorpicker/
    was one of the earlier experiments - I think - and that was March 2011 ...
  • JanghouFriday, November 30, 2012 9:21:41 PM

    Originally posted by miketaylr:

    So as long as you define the width to be smaller than the height, your browser should create a vertical range input for you


    :smile: clever

    Yeah, CSS Transforms was my initial thought, (take them out the flow.)

    Somehow rotated input fields don't work in Opera
    http://jsfiddle.net/Janghou/H92SF/

    But the spec way is the best. :smile:, much easier to handle then rotates.

    @QuHno, dude, your demo is from outer space. Let's go smoke some pot :smile:
  • QuHnoFriday, November 30, 2012 9:53:06 PM

    btw: The table at
    http://caniuse.com/#feat=input-range
    is slightly misleading. I have tested with the latest Chrome 25.0.1343.0 (170484) and it did *not* support vertical sliders, so it should get a "partial supported" only - but as far as I can see the spec doesn't say that it *must* rotate them but that it could do so, or did I miss something?

    Originally posted by Janghou:

    Somehow rotated input fields don't work in Opera


    works fine for me, see screenshot:
    http://my.opera.com/QuHno/albums/showpic.dml?album=3811932&picture=171762662
  • Mike TaylorSaturday, December 1, 2012 12:22:53 AM

    Originally posted by QuHno:

    btw: The table at
    http://caniuse.com/#feat=input-range
    is slightly misleading.

    That's entirely possible. Good news is you can submit pull requests or file issues on the data now: http://github.com/fyrd/caniuse
  • JanghouSaturday, December 1, 2012 10:58:49 PM

    @QuHno What platform are you on?

    Tried on clean install with stable and next (-pd tmp) and get this in Linux Ubuntu 64
    https://files.myopera.com/Janghou/screenshots/EditthisFiddle-jsFiddle-OperaNext_058.png

    Seems quite borked, background of ranges is really weird and only two sliders are shown
  • QuHnoSunday, December 2, 2012 6:51:31 PM

    @Janghou Win7 x64, Opera i386 and x64
    and yes, your screenshot looks really weird. Some other users confirmed it with different Linux distributions, but at least one with Open Suse had no problems.
  • JimTuesday, December 4, 2012 12:31:05 AM

    Neither works in FF20 nightly
  • Richard SextonThursday, January 3, 2013 10:36:06 PM

    Slick.

    What about other styling tips? For example the image shown at the top is the same as the Opera skin slider in the lower right. I don't really care about other browsers but how would I style what webkit calls the slider thumbnail?

    I'd be happy to have it be a css sphere but at this point I'll take anything. I tried the webkit commands, no dice, but the I didn't expect them to really work.

    I'd like to be able to use Opera skin widgets ideally so as the user reconfigures the browser their webware also changes automatically.

    Thanks and keep up the outstanding work.
  • Richard SextonMonday, January 7, 2013 4:01:27 AM

    Anyone? Hello? Is this thing on?
  • Richard SextonThursday, January 10, 2013 9:00:44 PM

    Hello,
    Is there anybody in there?
    Just nod if you can hear me
    Is there anyone home?
  • JimTuesday, January 15, 2013 8:16:39 PM

    Originally posted by rs79:

    Hello,
    Is there anybody in there?
    Just nod if you can hear me
    Is there anyone home?

    I don't think Opera allows it to be re-skinned via css.
  • Bruce LawsonTuesday, January 22, 2013 3:45:13 PM

    Richard Sexton

    not quite sure what you mean by "webware also changes automatically" but there currently isn't a mechanism to style these new browser-supplied widgets. I wrote about this today http://www.brucelawson.co.uk/2013/on-the-styling-of-forms/

  • QuHnoWednesday, January 23, 2013 6:53:28 AM

    Oooh... styling of forms ...

    The beast has a name and it's name is SELECT :devil:

    btw: An input type="font", exposing the system font dialog the same way as input type="color" does for the colo(u)rs, would be a nice to have too - can we have that as Opera proprietary until someone writes a convincing proposal to Hixie? :bigsmile:
  • Richard SextonFriday, February 1, 2013 4:55:33 AM

  • Richard SextonSaturday, February 2, 2013 9:22:14 PM

    What I mean Bruce, is if an web app uses whatever the browser uses for the range slider down there on the lower right, then if the user changes the browser skin then the web app slider would change automatically as well if it were indeed using that browser elements. Essentially it provides a level of indirection to the styling of elements the browser knows about already.

    That is, if we could use the range slider that's there now (grey on my machine) in our web apps and somebody changed the browser skin to, say, the "OMG PONIES" theme* then the range slider in our apps would also change, that is, it extend the property of being skinnable to the app as well as the browser.


    *no, there isn't an "OMG PONIES" theme.

About this article

Published inODIN blog
DateNovember 30, 2012
AuthorMike Taylor
Tagsinput, HTML5
OriginalInternet Archive