332

I have to maintain a large number of classic ASP pages, many of which have tabular data with no sort capabilities at all. Whatever order the original developer used in the database query is what you're stuck with.

I want to to tack on some basic sorting to a bunch of these pages, and I'm doing it all client side with javascript. I already have the basic script done to sort a given table on a given column in a given direction, and it works well as long as the table is limited by certain conventions we follow here.

What I want to do for the UI is just indicate sort direction with the caret character ( ^ ) and ... what? Is there a special character that is the direct opposite of a caret? The letter v won't quite cut it. Alternatively, is there another character pairing I can use?

Joel Coehoorn
  • 399,467
  • 113
  • 570
  • 794

18 Answers18

556

There's ▲: ▲ and ▼: ▼

Community
  • 1
  • 1
sblundy
  • 60,628
  • 22
  • 121
  • 123
284

Don't forget the (logical and) and (logical or) characters, that's what I use for indicating sort direction: HTML entities ∧ & ∨ respectively.

Mr. Polywhirl
  • 42,981
  • 12
  • 84
  • 132
Josh Bodily
  • 2,841
  • 1
  • 15
  • 2
67

There's always a lowercase "v". But seriously, aside from Unicode, all I can find would be &darr, which looks like ↓.

Max Lybbert
  • 19,717
  • 4
  • 46
  • 69
55

An upside-down circumflex is called a caron, or a háček.

It has an HTML entity in the TADS Latin-2 extension to HTML: ˇ and looks like this: ˇ which unfortunately doesn't display in the same size/proportion as the ^ caret.

Or you can use the unicode U+30C.

MarkHu
  • 1,694
  • 16
  • 29
Bill Karwin
  • 538,548
  • 86
  • 673
  • 828
39

˅˅˅˅˅˅˅˅˅˅˅˅˅˅˅˅˅˅˅˅˅

˅˅˅ Hǝɹǝ,s ɐ ɯɐʇɔɥᴉuƃ sǝʇ˙ ˅˅˅
˄˄˄ Here's a matching set. ˄˄˄

˄˄˄˄˄˄˄˄˄˄˄˄˄˄˄˄˄˄˄˄˄

"Actual size": ˅˄˅˄
(more info)


Edit: Another Option...

⋁⋁⋁⋁⋁⋁⋁⋁⋁⋁ Unicode #8897 / U+22C1 ("n-ary logical or")

⋀⋀⋀⋀⋀⋀⋀⋀⋀⋀ Unicode #8896 / U+22C0 ("n-ary logical and")

"Actual size": ⋁⋀⋁⋀

ashleedawg
  • 20,365
  • 9
  • 72
  • 105
24

A powerful option – and one which also boosts creativity – is designing your own characters using box drawing characters.

Want a down pointing "caret"? Here's one: ╲╱

I've recently discovered them — and I take great pleasure at using such custom designed characters for labeling things all around :) .

tomekwi
  • 2,048
  • 2
  • 21
  • 27
16

You might be able to use the black triangles, Unicode values U+25b2 and U+25bc. Or the arrows, U+2191 and U+2193.

Mark Ransom
  • 299,747
  • 42
  • 398
  • 622
10

c# code

int i = 0;
char c = '↑';
i = (int)c;
Console.WriteLine(i); // prints 8593

int j = 0;
char d = '↓';
j = (int)d;
Console.WriteLine(j); // prints 8595
Stevoisiak
  • 23,794
  • 27
  • 122
  • 225
shahkalpesh
  • 33,172
  • 3
  • 63
  • 88
9

You might consider using Font Awesome instead of using the unicode or other icons

The code can be as simple as (a) including font-awesome e.g. <link rel="stylesheet" href="https://cdnjs.cloudflare.com/ajax/libs/font-awesome/4.7.0/css/font-awesome.min.css"> (b) making a button such as <button><i class="fa fa-arrow-down"></i></button>

Stevoisiak
  • 23,794
  • 27
  • 122
  • 225
Colin D
  • 2,822
  • 1
  • 31
  • 38
  • 3
    Today, this is definitely a viable option. In 2008 when I asked the question, that would have been a challenge. But the ability to get these late answers as tech changes is part of what makes SO awesome :) – Joel Coehoorn May 31 '17 at 20:53
  • 2
    Good point. Also, just to add a reason why to use it, one possible reason to use font-awesome instead of unicode is that unicode is copy-and-pastable which I found was annoying on mobile, it would try to select when someone tapped a button with the unicode on it, while the font-awesome icons did not cause copy and paste – Colin D Jun 05 '17 at 13:58
  • 2
    Including FontAwesome (which is quite big in size) for just a few icons seems overkill though. I would advice against it. If text-selection is your issue, consider using the HTML code in a CSS pseudo element. – PoeHaH Jan 14 '18 at 07:27
6

I'd use a couple of tiny images. Would look better too.

Alternatively, you can try the Character Map utility that comes with Windows or try looking here.

Another solution I've seen is to use the Wingdings font for symbols. That has a lot fo arrows.

Vilx-
  • 104,512
  • 87
  • 279
  • 422
5

I did subscript capital & bolded V. It works perfectly (although it takes some effort, if it needs to be done repetitively)

Syntax:

<sub><strong>v</strong></sub>

Output:
v

Angel Politis
  • 10,955
  • 14
  • 48
  • 66
BCLaw15
  • 51
  • 1
  • 1
  • 1
    This approach is not recommended as it wouldn't look like what OP wants with fonts other than 'sans' fonts. – Awol Dec 05 '17 at 19:42
  • This lead me in the right direction. In my case, I used the ▼: ▼ character, but with superscript + subscript. In the case of HTML, it'd look like this: `` In my case, I am using it with Markdown, written like this: `~^▼^~` – John T. May 03 '21 at 19:30
5

The ^ (Caret - or Ascii Circumflex), produced by pressing shift + 6, does not appear to have an Ascii opposite, namely an Ascii Inverted Circumflex.

But for your alternative character pairing that also have keyboard combinations, you could use:

ˆ (Circumflex) shift + alt + i and
ˇ (Caron) shift + alt + t

Source: fileformat.info

nic
  • 169
  • 1
  • 9
  • This does not work on my Windows computer. Is this a Mac shortcut? If so, I wonder if there is a comparable shortcut in Windows. – SherylHohman Sep 24 '20 at 16:51
  • 1
    @SherylHohman yes. It was for a Mac. Sorry I forgot to mention that. – nic Oct 02 '20 at 00:51
5

U+2304 DOWN ARROWHEAD, in HTML as &#8964;

msh210
  • 256
  • 6
  • 23
4

There is no upside down caret character, but you can easily rotate the caret with CSS. This is a simple solution that looks perfect. Press 'Run code snippet' to see it in action:

.upsidedown {
transform:rotate(180deg); 
-webkit-transform:rotate(180deg);
-o-transform:rotate(180deg);
-ms-transform:rotate(180deg);
}
.upsidedown.caret {
display: inline-block; 
position:relative; 
bottom: 0.15em;
}
more items <span class="upsidedown caret">^</span>

Please note the following...

  • I did a little correction for the positioning of the caret, as it is normally high (thus low in the rotated version). You want to move it a little up. This 'little' is relative to the font-size, hence the 'em'. Depending on your font choice, you might want to fiddle with this to make it look good.
  • This solution does not work in IE8. You should use a filter if you want IE8 support. IE8 support is not really required nor common in 2018.
  • If you want to use this in combination with Twitter Bootstrap, please rename the class 'caret' to something else, like 'caret_down' (as it collides with a class name from Twitter Bootstrap).
Mr. Hugo
  • 11,887
  • 3
  • 42
  • 60
1

So I wanted the caret exactly as in OWA, so I downloaded office365icons.woff from https://owa.example.com/owa/prem/15.1.1913.10/resources/styles/fonts/office365icons.woff (have to be logged in to do it, so did it through browser) and then, copying the boiled-down style from the website:

  @font-face {
      font-family: 'Office365Icons';
      src: url('/fonts/office365icons.woff') format('woff');
      font-weight: normal;
      font-style: normal;
  }

  span.o-icon {
      font-family: 'Office365Icons';
      font-size: 14pt;
      line-height: 21px;
      color: #666;
  }

And finally:

<span class="o-icon">&#xe088;</span>
BaseZen
  • 8,650
  • 3
  • 35
  • 47
0

Could you just draw an svg path inside of a span using document.write? The span isn't required for the svg to work, it just ensures that the svg remains inline with whatever text the carat is next to. I used margin-bottom to vertically center it with the text, there might be another way to do that though. This is what I did on my blog's side nav (minus the js). If you don't have text next to it you wouldn't need the span or the margin-bottom offset.

<div id="ID"></div>

<script type="text/javascript">
var x = document.getElementById('ID');

// your "margin-bottom" is the negative of 1/2 of the font size (in this example the font size is 16px)
// change the "stroke=" to whatever color your font is too
x.innerHTML = document.write = '<span><svg style="margin-bottom: -8px; height: 30px; width: 25px;" viewBox="0,0,100,50"><path fill="transparent" stroke-width="4" stroke="black" d="M20 10 L50 40 L80 10"/></svg></span>';
</script>
  • Today, I could probably do that. In 2012 I wouldn't have trusted that option. And now that I have them, I like using the Unicode characters. – Joel Coehoorn Apr 26 '17 at 20:50
0

If you are needing font-awesome for React Apps then React Icons is a very good resource and very easy to implement. It includes a lot more libraries than just font-awesome.

Isaac Pak
  • 4,467
  • 3
  • 42
  • 48
  • 2
    Not sure why this is downvoted. It suggests a reasonable open-source alternative to consider (albeit not as simple as a standard Unicode character). – Jake Nov 25 '20 at 23:33
0

I found these in the MacOS symbols: ▾▴ Not sure if they will look proper on all devices though.

bergjs
  • 125
  • 2
  • 6