-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
  • 10,884
  • 14
  • 43
  • 67
Alireza Fattahi
  • 38,349
  • 12
  • 107
  • 156

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
  • 38,349
  • 12
  • 107
  • 156
Asraful Haque
  • 1,064
  • 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,026
  • 7
  • 71
  • 97