0

Is it possible to change the color of an image using only CSS?

(I'm using the transparent backgrounded glyphicons, and I need different symbol [not background] colors for my theme)

1

2 Answers 2

1

You can use image tints, but I don't know if it's going to give you the effect you expect:

Basically you wrap a <figure> element around your <img/> and apply styling to it:

/*HTML*/
<figure class="tint">  
  <img src="icon.png" width="400" height="260">  
</figure> 

/*CSS*/
.tint {  
    position: relative;  
    float: left;  
    cursor: pointer;  
}  

.tint:before {  
    content: "";  
    display: block;  
    position: absolute;  
    top: 0;  
    bottom: 0;  
    left: 0;  
    right: 0;  
    background: rgba(0,255,255, 0.5);  
    -moz-transition: background .3s linear;  
    -webkit-transition: background .3s linear;  
    -ms-transition: background .3s linear;  
    -o-transition: background .3s linear;  
    transition: background .3s linear;  
}  

.tint:hover:before {  
    background: none;  
}  

Check the link for a demo and full code samples.

On this website you can also check out some different methods.

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

2 Comments

Of course, this is only if you use <img/> tags. Otherwise, if it's a background in CSS, I don't know how to change it.
Thanks, but that does background as well (which I can get by appending e.g.: with style="background-color: red" to the parent tag).
0

No. As these are image icons you can not change their color. You can try using these http://www.entypo.com/. As these are fonts they can easily change colors.

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.