CSS ribbon with inside arrow on the right

后端 未结 2 1223
南方客
南方客 2020-12-10 21:18

I want to create a ribbon effect like on this image (the red part of image): \"ribbon

When I try to c

2条回答
  •  臣服心动
    2020-12-10 22:04

    Made a fiddle here. Couldn't solve it without a b tag though. I used b because it is so small

    HTML

    Kategorija
    

    CSS

    .mali_oglas_kategorija {        
        position: relative;
        display: inline-block;
        font-weight: bold;
        width: 100px;        
        padding: 6px 20px 6px 40px;
        margin: 10px 10px 10px -18px;
        color: #e5e5e5 !important;
        background-color: #760000;  
        -webkit-box-shadow: 3px 2px 4px rgba(0,0,0,.5);
        -moz-box-shadow: 3px 2px 4px rgba(0,0,0,.5);
        box-shadow: 3px 2px 4px rgba(0,0,0,.5);}    
    .mali_oglas_kategorija:before{
        content: ' ';
        position: absolute;
        width: 0;
        height: 0;
        left: 0px;
        top: 100%;
        border-width: 5px 10px;
        border-style: solid;
        border-color: #470000 #470000 transparent transparent;
    }
    
    .mali_oglas_kategorija:after{
        content: ' ';
        position: absolute;
        width: 0;
        height: 0;
        right: -10px;
        top: 0;
        border-width: 10px 5px;
        border-style: solid;
        border-color: #760000 transparent transparent #760000  ;
    }
    .mali_oglas_kategorija b {
        position: absolute;
        width: 0;
        height: 0;
        right: -10px;
        bottom: 0;
        border-width: 10px 5px;
        border-style: solid;
        border-color:  transparent transparent #760000 #760000 ;
    }
    
    
    body { padding: 50px;}
    

提交回复
热议问题