I want to create header of website. When I started create it, I notice one weird behavior of text tags (from h1 to p, spans and etc.). It adds that whitespace on the side of image where text is located.
header {
padding-top: 10px;
}
header .container-fluid .row>* {
height: 8rem;
}
header .logo>* {
vertical-align: middle;
}
header .logo .img {
height: 100%;
}
header .logo .title {
display: inline-block;
padding-left: 0.5rem;
}
<header>
<div class="container-fluid">
<div class="row">
<div class="logo col-12 col-md-auto">
<img class="img" src="https://cdn.pixabay.com/photo/2017/11/12/13/37/forest-2942477__340.jpg">
<p class="title">Any text causes strange behavior</p>
</div>
</div>
</div>
</header>
If you still don't understand what I'm talking about, here is screenshot:
See this blue line? This is that weird whitespace.
UPD 1:
I changed padding-left: 0.5rem; to margin-left: 0.5rem; but whitespace is still here.
UPD2:
Also found a solution thanks to Matt Croak for link.
Solution is to add font-size:0 to logo block and set font-size: initial; or font-size: 16px; to header .logo .title.