-1

There is an icon with a text in front of it. I can align the text in the middle of icon by using style="vertical-align: middle;"

So below works fine:

<i class="fa fa-arrows-alt fa-5x" style="vertical-align: middle;"></i> a Big Arrow.

The problem is when we add a <br> the alignment is not work any more ( As the icon is simple character)

<i class="fa fa-arrows-alt fa-5x" style="vertical-align: middle;"></i> a Big Arrow </br> I mean very Big!

Please see http://jsfiddle.net/tQYTB/1/

Can you tell me what is the best solution for it!

James A Mohler
  • 11,060
  • 15
  • 46
  • 72
Alireza Fattahi
  • 42,517
  • 14
  • 123
  • 173

2 Answers2

2

Use span tag whenever you want to change some portion of the content.......

span {
  display: inline-block;
    vertical-align: middle;

}

enter image description here

Alireza Fattahi
  • 42,517
  • 14
  • 123
  • 173
Asraful Haque
  • 1,109
  • 7
  • 17
1

Here you go: http://jsfiddle.net/tQYTB/3/

Basically, wrap the label text in a span

HTML

<i class="fa fa-arrows-alt fa-5x" style="vertical-align: middle;"></i>
<span class="label">a Big Arrow. <br/> I mean real Big</span>

CSS

.label {
    display: inline-block;
    vertical-align: middle;
}
kumarharsh
  • 18,961
  • 8
  • 72
  • 100