html - Less :hover not overwriting :before color -
i have link :before pseudo class.
i'm trying style content grey, red on hover, using less. however, can't find combination of code both default color , hover color work.
code pen: http://codepen.io/niahc/pen/zvnapj
less code:
.icon-support:before { content: "acvzssd"; } .help { .icon-support { &:before { color: grey; } &:hover, &:focus, &:active { color: red !important; } } } html:
<a class="help" href="#"> <span class="icon-support"></span> </a>
to work, need specify style on ::before pseudoelement instead of on element itself, final less code this:
.icon-support::before { content: "acvzssd"; } .help { .icon-support { &::before { color: grey; } &:hover::before, /* <-- change "before" here */ &:focus::before, /* <-- , here */ &:active::before { /* <-- , here */ color: red; } } } fixed codepen: http://codepen.io/maxlaumeister/pen/xwgzjq
and here live demo using compiled css:
.icon-support::before { content: "acvzssd"; } .help .icon-support::before { color: grey; } .help .icon-support:hover::before, .help .icon-support:focus::before, .help .icon-support:active::before { color: red; } <a class="help" href="#"> <span class="icon-support"></span> </a>
Comments
Post a Comment