Is there an upside down caret character?

后端 未结 17 2016
Happy的楠姐
Happy的楠姐 2020-12-07 07:27

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 d

相关标签:
17条回答
  • 2020-12-07 08:00

    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>
    
    0 讨论(0)
  • 2020-12-07 08:02

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

    0 讨论(0)
  • 2020-12-07 08:02

    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.

    0 讨论(0)
  • 2020-12-07 08:04

    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).
    0 讨论(0)
  • 2020-12-07 08:05

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

    0 讨论(0)
  • 2020-12-07 08:11

    There's ▲: &#9650; and ▼: &#9660;

    0 讨论(0)
提交回复
热议问题