Question

I want to make a part of shape different color using CSS or Javascript.

For example; enter image description here

I want to change green level programmatically.

Was it helpful?

Solution

Font-awesome icons are text. You cant do that with text.

What you can do is absolutely-position one character on top of the other and using overflow:hidden on the top one, adjust its height to reveal the bottom-half according to the height you need.

Like this:

.icon {
    position:relative;
    color:#000;
    font-size:50px
}

.overlay {
    position:absolute;
    top:0;
    left:0;
    color: #f00;
    height:25px;
    overflow:hidden;
}

HTML:

<div class="icon">X<div class="overlay">X</div></div>
Licensed under: CC-BY-SA with attribution
Not affiliated with StackOverflow
scroll top