在伪元素前后使用 CSS 创建左箭头

Create Left Arrow with CSS before & after pseudo elements

我创建了一个右箭头。

如何将其翻转为第二个左箭头?

http://jsfiddle.net/n0rxtr48/

a {
    display: inline-block;
    font-family: Arial, Helvetica, sans-serif;
    font-weight: bold;
    padding: 10px 15px 10px 10px;
    position: relative;
    text-decoration: none;
}

a:before, a:after {
    border-right: 2px solid;
    content: '';
    display: block;
    height: 8px;
    margin-top: -6px;
    position: absolute;
    -moz-transform: rotate(135deg);
    -o-transform: rotate(135deg);
    -webkit-transform: rotate(135deg);
    transform: rotate(135deg);
    right: 10px;
    top: 50%;
    width: 0;
}

a:after {
    margin-top: -1px;
    -moz-transform: rotate(45deg);
    -o-transform: rotate(45deg);
    -webkit-transform: rotate(45deg);
    transform: rotate(45deg);
}

a:hover, a:focus,
a:hover:before, a:hover:after,
a:focus:before, a:focus:after {
    color: #000;
}
<a class="arrow"></a>

Tranform CSS 属性 不适用于很多设备。我建议您使用 Unicode 符号.

这是箭头列表:http://unicode-table.com/en/sets/arrows-symbols/

您可以像这样将箭头旋转 180 度:

a {
    display: inline-block;
    font-family: Arial, Helvetica, sans-serif;
    font-weight: bold;
    padding: 10px 15px 10px 10px;
    position: relative;
    text-decoration: none;
}
.left{
  transform:rotate(180deg);
}

a:before, a:after {
    border-right: 2px solid;
    content: '';
    display: block;
    height: 8px;
    margin-top: -6px;
    position: absolute;
    transform: rotate(135deg);
    right: 10px;
    top: 50%;
    width: 0;
}

a:after {
    margin-top: -1px;
    transform: rotate(45deg);
}

a:hover, a:focus,
a:hover:before, a:hover:after,
a:focus:before, a:focus:after {
    color: #000;
}
<a class="arrow"></a>
<a class="arrow left"></a>

您也可以使用 scaley(-1) 而不是旋转来实现相同的输出。

也有更简单的方法来制作这个箭头,你可能想检查这个 post 像这样的箭头列表:How to Make A Fancy Arrow Using CSS?

或者你可以使用边框

:root{text-align: center}
a{width: 10px; height: 10px; position: relative}
a:before, a:after {
    color: black;
    border-right: 2px solid currentcolor;
    border-bottom: 2px solid currentcolor;
    content: '';
    position: absolute;
    width: 16px;
    height: 16px
}

a:before{
    left: -16px;
    transform: rotate(135deg)
}
a:after{
    right: -16px;
    transform: rotate(-45deg)
}
<a></a>