Creating custom prefix styling

Creating custom prefix styling

So the 3rd value is supposed to change the border color but mine never changes. any idea?
 
Great tutorial, thanks!

How you would do this code if you wanted the icon to the right of the text with the 4px in between text and icon and normal padding at the ends? Thanks for any help.

Your code:
Code:
/* #### Thread Prefixes #### */
.label
{
    &:before
    {
        padding-right: 4px;
        .m-faBase();
    }

    &.label--
    {
        &ctaAttention:before
        {
            .m-faContent(@fa-var-exclamation-triangle);
        }

        &ctaAnnouncement:before
        {
            .m-faContent(@fa-var-bullhorn);
        }

        &ctaNotice:before
        {
            .m-faContent(@fa-var-flag);
        }

        &ctaPoll:before
        {
            .m-faContent(@fa-var-poll-h);
        }
    }
}
 
You can probably just change :before to :after and change padding-right to padding-left. You also don't need .m-faBase() in 2.3+.
 
You can probably just change :before to :after and change padding-right to padding-left. You also don't need .m-faBase() in 2.3+.
That's exactly what I tried but for some reason it adds padding to both sides of the icon. To test it I add a large number like 50px and it shows on both sides of the FA.
 
You can do most in one line in extra.less without touching any templates.

CSS:
.label.label--FORMULA1 { border-color: #6ABCDC; background: linear-gradient(45deg, #CB2D3E 0%, #EF473A 100%); box-shadow: inset 0px 0px 0px 0px; font-family:'Roboto',sans-serif; color:#fff; padding: 2px 5px 0px 1px; &:before{ .m-faContent(@fa-var-flag-checkered); font-size: 1.1em; padding-right: 5px;  }}
.label.label--ANDROID { border-color: #78C257; background: linear-gradient(to bottom, #78C257, #78C257 100%); box-shadow: inset 0px 0px 0px 0px; font-family:'Roboto',sans-serif; color:#fff; padding: 2px 5px 0px 1px; &:before{ .m-faContent(@fa-var-android); font-size: 1.1em; padding-right: 5px;  }}

You can further adjust the styling as needed in the two examples above.

Then you would add the label to your prefix like below.

1791143696032.webp
 
Back
Top Bottom