There is the following HTML code:
<div class="preloader">
<img src="img/preloader.gif">
<span>
<strong>Получение адреса...</strong>
</span>
</div>
CSS code:
.preloader span {
display: inline-block;
vertical-align: middle;
margin: 0 auto;
}
I align span in div vertically, but now I need to align span horizontally. I've tried to use 'margin: 0 auto', but it doesn't work. Please tell me, how can I do it? Thanks! I need image with left alignment and text with center alignment as a result.
Use text-align: center;:
.preloader {
text-align: center;
}
.preloader img {
float: left;
}
.preloader span {
line-height: 64px;
}
<div class="preloader">
<img src="http://orig14.deviantart.net/f682/f/2010/331/4/e/darth_vader_icon_64x64_by_geo_almighty-d33pmvd.png">
<span>
<strong>Получение адреса...</strong>
</span>
</div>
Fiddle: http://jsfiddle.net/r0z75mey/4/
If you love us? You can donate to us via Paypal or buy me a coffee so we can maintain and grow! Thank you!
Donate Us With