证明框的 CSS 三 Angular 形

标签 css

我有一个推荐框,我想在其中添加一个三 Angular 形。

.arrow {
    float: left;
    margin-left: 25px;
    margin-top: 20px;
    width: 0;
    height: 0;
    border-top: 20px solid #eee;
    border-left: 0px solid transparent;
    border-right: 25px solid transparent;
}

问题是三 Angular 形最终是实心的,而不是带有灰色边框的白色。下面是 CSS 当前显示方式的屏幕截图。在此先感谢您的时间和帮助。

enter image description here

最佳答案

您可以创建两个三 Angular 形,一个重叠另一个,以创建这种镶边效果。您可以使用::before 和::after 伪元素来做到这一点,这样您就不会拥有任何多余的 HTML。

http://jsfiddle.net/7K2c4/

.mybox {
    position: relative;
    border: 1px solid #ccc;
}
.mybox:before, 
.mybox:after { position: absolute;
    left: 20px;
    bottom: -19px;
    display: block;
    width: 0;
    height: 0;
    border-width: 0 25px 20px;
    border-style: solid;
    border-color: transparent;
    border-left-color: #fff;
    content: ' ';
}
.mybox:before { left: 19px;
    bottom: -21px;
    border-left-color: #ccc; }

关于证明框的 CSS 三 Angular 形,我们在Stack Overflow上找到一个类似的问题: https://stackoverflow.com/questions/20319195/

相关文章:

html - 我无法修改集成 WordPress 代码的 css

css - 如何在悬停时反转转换?

html - 将动画添加到动画中的最终方 block

css - 在 Shopify liquid 中使用 @font-face 时出现字体文件 404

css - 如何覆盖显示 : table cell

CSS 和第一个 child

css - 选中时如何更改文本输入的 CSS?

javascript - 如何根据绝对容器中响应图像的高度设置父(相对)的动态高度

CSS:高度=宽度(另一种情况)

html - 通过使用 <p> 和一些 CSS 转换旋转文本,使文本换行