创建底部响应箭头

Create bottom responsive arrow

我需要创建带有向下箭头的网格。见下图:

问题是 div 由于 .col-xs-3 而具有可变宽度。我怎样才能给箭头(:after 元素)适当的宽度,以便它仍然可以响应?

我的CSS:

.grid-arrow::after {
    content: " ";
    display: block;
    width: 0;
    height: 0;
    border-top: 47px solid transparent;
    border-bottom: 47px solid transparent;
    border-left: 40px solid rgb(173, 173, 173);
    position: absolute;
    /* top: 50%; */
    margin-top: -37px;
    /* margin-left: 1px; */
    left: 50%;
    z-index: 3;
    -webkit-transform: rotate(90deg);
        -ms-transform: rotate(90deg);
            transform: rotate(90deg);
}

我的HTML:

<div class="col-xs-3 advantage grid-arrow">
    <div>
        Some text
    </div>
</div>

正如@ochi所指出的,已经有一个solution that might work for you

把它带回你的代码,它会是这样的:

HTML:

<div class="col-xs-3 advantage grid-arrow">
    <div>
        Some text.
    </div>
</div>

CSS:

.grid-arrow {
    position: relative;
    text-align: center;
    background-color: red;
    line-height: 2em;
    border-top:300px solid #fff;
    top:-300px;
}
.grid-arrow::after {
    content: "";
    position: absolute;
    left: 0;
    background-color: red;
    padding-bottom: 50%;
    width:57.7%;
    z-index:-1;

    -webkit-transform-origin:0 0;
    -ms-transform-origin:0 0;
    transform-origin:0 0;

    -webkit-transform: rotate(-30deg) skewX(30deg);;
    -ms-transform: rotate(-30deg) skewX(30deg);
    transform: rotate(-30deg) skewX(30deg);
}

JsFiddle