Logo Questions Linux Laravel Mysql Ubuntu Git Menu
 

How to blur or to add transparency to fontawesome icon

I am using bootstrap and fontawesome. I've got a bullet list like that:

<ul class="fa-ul lead">
    <li class="m"><i class="fa-li fa fa-2x fa-check"></i><p>Text.</p></li>
    <li class="m"><i class="fa-li fa fa-2x fa-check"></i><p>Text.</p></li>
    <li class="m"><i class="fa-li fa fa-2x fa-check"></i><p>Text.</p></li>
    <li class="m"><i class="fa-li fa fa-2x fa-check"></i><p>Text.</p></li>  
</ul>

The icons fa produced a bit too rich and vivid. I want to add a bit transparency or something to make them looking not so much vivid. Is there any way I can do that without any custom css?

UPDATED: By saying custom css I meant that may be there is some bootstrap or fontawesome css classes already exists in order to do that. So I was looking for css solution.

like image 417
sreginogemoh Avatar asked Dec 19 '14 09:12

sreginogemoh


People also ask

How do I add background color to Font Awesome icons?

You can simply set a single "color" property to set the color of the character/icon to be what you want. If the background circle offsets the icon, you can use line-height to fix it.

Can I color Font Awesome icons?

You can customize Font Awesome Icon fa Icon Fa as per your requirement, suppose that you need to chnage the color of Fa icon or change the size of size. It is pretty simple to change color of icon Fa just add style="color:red" it will make font color red.

Can you animate Font Awesome icons?

Sure! It doesn't matter if it's a font icon or an SVG icon, you can still animate the element with CSS.


2 Answers

As stated on Font Awesome's homepage:

Font Awesome gives you scalable vector icons that can instantly be customized — size, color, drop shadow, and anything that can be done with the power of CSS.

There's absolutely no reason not to use CSS, so ignoring your requirement of not using CSS I'm going to give you a CSS solution anyway and suggest you use this instead of the non-CSS solution I've also provided:

CSS Solution

Font Awesome icons are characters contained within a font. This makes them regular text, allowing you to style the characters as you would regular text.

.fa-li.fa.fa-2x.fa-check {
    opacity: 0.75;                /* Opacity (Transparency) */
    color: rgba(0, 0, 0, 0.75);   /* RGBA Color (Alternative Transparency) */
    -webkit-filter: blur(2px);    /* Blur */
    -moz-filter: blur(2px);
    filter: blur(2px);
}

A better solution might just be to change the colour of your icons to something less prominent:

.fa-li.fa.fa-2x.fa-check {
    color: #444;
}

Non-CSS Solution

If you really want a non-CSS solution, like you've stated in the question, one thing you could do is save the relevant icon as an image and play around with it in any picture editing software to apply the effect you're looking for. Then, instead of adding the icon in using the provided Font Awesome CSS, you could upload the image to your server and include it as an img element:

<img src="path/to/my-modified-fa-icon.png" alt="fa-check" />
like image 161
James Donnelly Avatar answered Sep 25 '22 17:09

James Donnelly


how about

.fa{
    opacity:0.5;
}

Thats assuming you want all fa icons a little 'see through' you could of course always change the colour too, so maybe use grey instead of black

.fa{
    color:#878787;
}

If you only want to style this lists fa's try

.m .fa{
    opacity:0.5;
}

or if you are using sass/less

.m{
    .fa{
        opacity:0.5;
    }
}
like image 20
atmd Avatar answered Sep 25 '22 17:09

atmd