0

I have two senario class started from icn- and in-betwen icn- .Both have same properties.can we add one selector or regex which work in both cases ?

 .f20 [class^="icn-"]:before,.f20 [class*=" icn-"]:before {
            font-family: 'icons' !important;
            speak: none;
            font-style: normal;
            font-weight: normal;
            font-variant: normal;
            text-transform: none;
            line-height: 1;
            -webkit-font-smoothing: antialiased;
            -moz-osx-font-smoothing: grayscale
        }
2
  • 3
    Any reason why icn is not a class? you can select based on multiple classes. Edit: for example if you make icn-whatever into two classes icn and whatever, then where you had .icn-whatever you can put .icn.whatever (notice no spaces). And that, would, of course, allow you to just select .icn separatedly if you needed. Commented Nov 10, 2020 at 7:50
  • This is related: stackoverflow.com/a/23963317/510788 Commented Nov 10, 2020 at 7:55

1 Answer 1

0

In your case you can write the following:

.f20 [class*="icn-"]:before {
   color: pink; /*whatever you want goes here*/
}

This selects any icn- class if it is either at the beginning or somewhere else. Note this also selects something like this-icn-class since it only checks for icn- and doesn't care what character is in front.

Sign up to request clarification or add additional context in comments.

Comments

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service and acknowledge you have read our privacy policy.

Start asking to get answers

Find the answer to your question by asking.

Ask question

Explore related questions

See similar questions with these tags.