How to change style for before/after in Angular?

前端 未结 3 596
深忆病人
深忆病人 2021-01-04 09:49

I\'m trying implement breadcrumbs with triangles using before/after in the CSS, as shown in this tutorial:

http://css-tricks.com/triangle-breadcrumbs/

Releva

3条回答
  •  太阳男子
    2021-01-04 10:28

    If I understand your question correctly, you want to know how to use an angular directive to dynamically style the before/after pseudo-tags.

    Instead of using ng-style, use ng-class to attach a class that will determine which before/after pseudo class to use.

    
    

    And in CSS:

    .breadcrumb li a:after { 
        content: " "; 
        display: block; 
        width: 0; 
        height: 0;
        border-top: 50px solid transparent;           
        border-bottom: 50px solid transparent;
        border-left: 30px solid hsla(34,85%,35%,1);
        position: absolute;
        top: 50%;
        margin-top: -50px; 
        left: 100%;
        z-index: 2; 
    }
    
    .breadcrumb li a.color-0:after {
        background: black;
    }
    
    .breadcrumb li a.color-1:after {
        background: blue;
    }
    

提交回复
热议问题