How to create a border that fully covers the adjacent corners in CSS?

前端 未结 7 1891
闹比i
闹比i 2020-12-17 09:00

I have a div with a 1px border and I\'m trying to create a 3px border in another color to that div. I\'m using this code:

box {
  border: 1px solid #ffffd;
  b         


        
相关标签:
7条回答
  • 2020-12-17 09:36

    Welcome to the css borders. The only way to properly do that is using :after or :before pseudoelements.

    Fiddle

    .box {
        border: 1px solid #ffffd;
        position: relative;
    }
    .box:after {
        position: absolute;
        display: block;
        content:'';
        /* Positioning */
        top: 0;
        width: 100%;
        height: 3px;
        left: 0;
        right: 0;
        /* Color */
        background-color: #3F9BD0;
    }
    
    0 讨论(0)
提交回复
热议问题