带有向下箭头的HTML行

use*_*559 4 html css html5

我试图用一个小箭头画一条线,如图所示.

在此输入图像描述

我无法得到向下箭头.有没有办法可以用html和css做到这一点?

HTML

  <hr class="line">
Run Code Online (Sandbox Code Playgroud)

CSS

.line{
width:70%;
color:red;
}
Run Code Online (Sandbox Code Playgroud)

http://jsfiddle.net/4eL39sm1/

谢谢.

Ale*_*har 11

您可以使用伪元素:after:before:

.line {
    width:70%;
}
.line:after {
    content:'';
    position: absolute;
    border-style: solid;
    border-width: 7px 7px 0;
    border-color: #FFFFFF transparent;
    display: block;
    width: 0;
    z-index: 1;
    top: 8px;
    left: 45%;
}
.line:before {
    content:'';
    position: absolute;
    border-style: solid;
    border-width: 7px 7px 0;
    border-color: #7F7F7F transparent;
    display: block;
    width: 0;
    z-index: 1;
    top: 9px;
    left: 45%;
}
Run Code Online (Sandbox Code Playgroud)
<hr class="line">
Run Code Online (Sandbox Code Playgroud)

您可以根据border-width需要调整大小.