Logo Questions Linux Laravel Mysql Ubuntu Git Menu
 

Combine two Font Awesome icons

I'm trying to combine two Font Awesome icons, to create a stack. I'm trying to merge fa-calendar and fa-clock-o icons. This because, I need an icon for date-time.

So, in order to combine them, I tried this:

HTML

<span class="icon-stack">
   <i class="fa fa-calendar icon-stack-3x"></i>
   <i class="fa fa-clock-o icon-stack-1x"></i>
</span>

CSS

.icon-stack {
  position: relative;
  display: inline-block;
  width: 2em;
  height: 5em;
  line-height: 4em;
  vertical-align: middle;
}
.icon-stack-1x,
.icon-stack-2x,
.icon-stack-3x {
  position: absolute;
  left: 0;
  width: 100%;
  text-align: center;
}
.icon-stack-1x {
  line-height: inherit;
}
.icon-stack-2x {
  font-size: 1.5em;
}
.icon-stack-3x {
  font-size: 2em;
}

This is what I get as a result.

enter image description here

But, I want to bring a little bit to right. I don't know how to do that? What can I do to bring it a bit towards right?

like image 622
SSS Avatar asked Nov 15 '16 12:11

SSS


1 Answers

Well, as you have done your own CSS for position you just need to set the text-align to right, like this:

.icon-stack-3x {
  position: absolute;
  left: 0;
  width: 100%;
  text-align: right;
}

Here is a working example


The problem is, that doesn't look great. So here are a couple of alternatives in case they are of use to you: Example 1, Example 2

like image 67
musefan Avatar answered Sep 29 '22 17:09

musefan