Logo Questions Linux Laravel Mysql Ubuntu Git Menu
 

Add Logo & Title to NavBar (Yii2)

Tags:

navbar

yii2

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?

like image 807
Ragheb AlKilany Avatar asked Oct 19 '15 09:10

Ragheb AlKilany


2 Answers

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',
like image 66
Nerdwood Avatar answered Dec 25 '22 02:12

Nerdwood


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:

enter image description here

like image 36
SaidbakR Avatar answered Dec 25 '22 03:12

SaidbakR