How to create triangle shape in the top-right angle of another div to look divided by border

后端 未结 3 772
夕颜
夕颜 2020-12-08 06:39

I want to create shape like on this picture:

\"shape\"

I created triangle shape like on this pic, and s

3条回答
  •  [愿得一人]
    2020-12-08 07:09

    I'd suggest, given the following mark-up:

    #box {
        width: 10em;
        height: 6em;
        border: 4px solid #ccc;
        background-color: #fff;
        position: relative;
    }
    
    #box::before,
    #box::after {
        content: '';
        position: absolute;
        top: 0;
        right: 0;
        border-color: transparent;
        border-style: solid;
    }
    
    #box::before {
        border-width: 1.5em;
        border-right-color: #ccc;
        border-top-color: #ccc;
    }
    
    #box::after {
        border-radius: 0.4em;
        border-width: 1.35em;
        border-right-color: #0c0;
        border-top-color: #0c0;
    }

提交回复
热议问题