Question

I have this css/HTML code for show icon in h1 :

CSS:

h1 {
font-size:32px;
font-weight:400;
margin:6px 0;

}
h1>i {
display:inline-block;
vertical-align:middle;
text-align:center;
}

HTML:

<div class="container">
<h1><i class="icon-search"></i>Bootstrap 3 Glyphicons</h1>
</div>

But vertical-align not worked for bootstrap 2.3.2. NOTE: I know this worked in version 3.+. how to fix this problem for this version?

demo here

Was it helpful?

Solution

Try this instead to overload twitter bootstrap default rule for h1 :

h1>[class^="icon-"], h1>[class*=" icon-"] {
    vertical-align: middle;
}

Updated demo

OTHER TIPS

There seems to be more css to it than showing in the bootply css-text-field.

[class^="icon-"], [class*=" icon-"] {
    vertical-align:text-top;
}

If you add

.icon-search {
    vertical-align: middle;
}

...to your css, it will position the image centered vertically.

Licensed under: CC-BY-SA with attribution
Not affiliated with StackOverflow
scroll top