문제

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.

도움이 되었습니까?

해결책

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>
라이센스 : CC-BY-SA ~와 함께 속성
제휴하지 않습니다 StackOverflow
scroll top