Reputation: 2642
I have h2
tag and there is content :before
.
HTML
<h2 class="glyphicon arrow-heading text-white margin-zero" style="z-index: 1;">
This is h2 tag and it has word spacing problem
</h2>
CSS
.arrow-heading:before {
content: "\e072";
color: #9B0D25;
float: left;
}
.glyphicon {
position: relative;
top: 1px;
display: inline-block;
font-family: 'Glyphicons Halflings';
font-style: normal;
font-weight: 400;
line-height: 1;
-webkit-font-smoothing: antialiased;
-moz-osx-font-smoothing: grayscale;
}
.text-white {
color: #FFF;
}
.margin-zero {
margin: 0em;
}
h2 {
font-size: 1.5vw;
}
But I get extra spacing as shown below without text-align: justify;
I want no extra spacing.
EDIT
With text-align: justify;
Upvotes: 3
Views: 298
Reputation: 749
I answered in the comments, but the Glyphicon Haflings
font is being applied to the entire <h2>
tag, and this will cause the spacing problem. The font should only be applied to the element that is specifically containing the Glyphicon.
To increase specificity, you could use an <i>
tag as the first child of <h2>
, and another would be (as OP did) moving the font-family
to the .arrow-heading:before
selector in your CSS.
Upvotes: 4