2017-02-27 40 views
2

是否可以爲yii/yii2框架設置標籤背景圖片?不要更改背景顏色或字體。這是否改爲CSS?任何示例都可以參考?yii選項卡背景圖像可能使其顯示?

enter image description here

+0

更新您的問題並顯示這些標籤的視圖代碼 – scaisEdge

+0

只是想知道是否可以在鼠標懸停後更改這些標籤的背景顏色? –

回答

0

是能夠

tipically在Yii2凸片形式是基於bootstrap3 CSS tempalete所以可以使用標籤(非編碼)用於分配標籤文本的IMG istead

echo Tabs::widget([ 
'items' => [ 
    [ 
     'label' => '<img src="your_source_url/your_image.jpg">', 
     'encode' =>false, 
     'active' => true 
    ], 

或對於bakground顏色,您可以使用選項指定您所選擇的樣式(或類)

echo Tabs::widget([ 
'items' => [ 
    [ 
     'label' => 'my_label', 
     'options' => ['style' ='background-color: red;] 
     'active' => true 
    ], 

http://www.yiiframework.com/doc-2.0/yii-bootstrap-tabs.html# $ items-detail

+0

好的謝謝。知道如何解決它! –