Stacking Font-Awesome Star Icons (fa-star & fa-star-half)

Jesse picture Jesse · Jun 13, 2015 · Viewed 12.8k times · Source

I want to stack the two Font Awesome icons fa-star and fa-star-half, but I am having alignment issues. See image below:

Attempt to stack fa-star and fa-star-half fails due to alignment of icons

Here is my HTML:

<span class="fa-stack">
     <i class="fa fa-fw fa-lg fa-star-half fa-stack-1x"></i>
     <i class="fa fa-fw fa-lg fa-star fa-stack-1x"></i>
</span>

...and my CSS:

a-stack i.fa-star {
    color:transparent;
    -webkit-text-stroke-width: 1px;
    -webkit-text-stroke-color: orange;
}

.fa-stack i.fa-star-half {
    color:yellow;
    -webkit-text-stroke-width: 1px;
    -webkit-text-stroke-color: orange;
}

Note that I do not want to use fa-star-half-o which has an unappealing design when used with an outline.

I have tried to use "float," but without success. If I use "margin-left," the spacing is off. See image below:

enter image description here

Any help is appreciated. Thanks!

Jesse

Answer

TheOnlyError picture TheOnlyError · Jun 14, 2015

Use the following margin-left to line up the image. Check it out here: https://jsfiddle.net/f63h157x/1/

enter image description here

.fa-stack i.fa-star-half {
    color:yellow;
    -webkit-text-stroke-width: 1px;
    -webkit-text-stroke-color: orange;
    margin-left: -5px;
}