0

我想要一个 div 左右两侧的箭头。像这里一样,但在两边:http ://cssarrowplease.com/

那可能吗?

4

1 回答 1

5

在里面添加一个额外的 div ,你也.arrow可以在上面添加一个伪类。(注意:额外的 div 是必要的,因为有额外的边框。边框是通过创建两个重叠的 div 来创建的,并且):before:after:before:after

.arrow_box { 
    position: relative; 
    background: #88b7d5; 
    border: 4px solid #c2e1f5; 
    width: 200px;
}
.arrow_box:after, .arrow_box:before { 
    bottom: 100%; 
    border: solid transparent; 
    content: " "; 
    height: 0; 
    width: 0;
    position: absolute;
} 
.arrow_box:after { 
    border-color: rgba(136, 183, 213, 0); 
    border-bottom-color: #88b7d5;
    border-width: 30px;
    left: 50%; 
    margin-left: -30px; 
} 
.arrow_box:before { 
    border-color: rgba(194, 225, 245, 0); 
    border-bottom-color: #c2e1f5; 
    border-width: 36px; 
    left: 50%; 
    margin-left: -36px;
}
.arrow_box > div:after, .arrow_box > div:before { 
    top: 100%; 
    border: solid transparent; 
    content: ""; 
    height: 0; 
    width: 0;
    position: absolute;
} 
.arrow_box > div:after { 
    border-color: rgba(136, 183, 213, 0); 
    border-top-color: #88b7d5;
    border-width: 30px;
    left: 50%; 
    margin-left: -30px; 
} 
.arrow_box > div:before { 
    border-color: rgba(194, 225, 245, 0); 
    border-top-color: #c2e1f5; 
    border-width: 36px; 
    left: 50%; 
    margin-left: -36px;
}
<div class="arrow_box">
    <div>
        bla!<br />
        bla!<br />
        bla!<br />
        bla!<br />
        bla!<br />
        bla!<br />
    </div>
</div>

和一个演示

于 2013-09-10T14:58:01.727 回答