Creating a triangle div with CSS

后端 未结 1 1767
没有蜡笔的小新
没有蜡笔的小新 2021-01-20 17:33

I have recently learned how to create the appearance of a triangle div with CSS and HTML. Now, I would like to know if it is at all possible to add a border around any of th

1条回答
  •  轻奢々
    轻奢々 (楼主)
    2021-01-20 18:17

    This is the typical way to do it:

    JSFiddle

    .arrow-up:after {
        position:absolute;
        content:"";
        width: 0;
        height: 0;
        margin-top:1px;
        margin-left:2px;
        border-left: 10px solid transparent;
        border-right: 10px solid transparent;
        border-bottom: 10px solid white;
    }
    
    .arrow-up:before {
        position:absolute;
        content:"";
        width: 0;
        height: 0;
        border-left: 12px solid transparent;
        border-right: 12px solid transparent;
        border-bottom: 12px solid black;
    }
    

    0 讨论(0)
提交回复
热议问题