Geodrey
Geodrey

Reputation: 31

How to add custom styles to a link in yii2

Am using the admin LTE and would like to customize the sidebar as part of my layout

Am customizing a link in yii2 by adding an extra style.
I have tried:
<li>
<?= Html::a('<span> Site </span>',['/site/index'],['class'=>'fa fa- calendar'],
  ['options'=>['template'=>'<small class="label pull-right bg-red">3</small>',
        ]]) ?>

    </li>

The final result should be:

<li>
      <a href="pages/calendar.html">
            <i class="fa fa-calendar"></i> <span>Calendar</span>
            <small class="label pull-right bg-red">3</small>
          </a>
 </li>

The problem is that the part:

small class="label pull-right bg-red">3</small>
does not get displayed

Upvotes: 1

Views: 2882

Answers (1)

ScaisEdge
ScaisEdge

Reputation: 133380

Try this way

<li>
 <?= Html::a('<span> Site </span><small class="label pull-right bg-red">3</small>',
    ['/site/index'],
    ['class'=>'fa fa- calendar'],
 ]) ?>
</li>

Upvotes: 2

Related Questions