How can I add a logo + title to a Yii2 web app?
I used concatenation to stick logo to title (as below)
NavBar::begin([
'brandLabel' => '<img src="favicon-32x32.png"; class="img-responsive">'.'Car Management System',
and it worked but the logo appeared on top of the title. Is this a wrong way to make it? Or is it right but it needs some style properties changed?
See if this works for you, it just changes the <img>
syntax to be correct:
'brandLabel' => '<img src="favicon-32x32.png" class="img-responsive"/>Car Management System',
If you are having problems with the image and the text not sitting on the same line, you probably want to replace the img-responsive
class with the pull-left
class... or just remove the img-responsive
class and it may start working (depending on the styles already applied to the image). Example:
'brandLabel' => '<img src="favicon-32x32.png" class="pull-left"/>Car Management System',
I have the same issue, in addition I have a square image of 48x48
. I have solved it like your initial solution but with the help of the following style
attribute's values:
...
'brandLabel' => '<img src="logo.png" style="display:inline; vertical-align: top; height:32px;">My Company',
...
The final result is shown in the following screen shot:
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