2013-04-23 85 views
0

我正在使用Bootstrap向我的網站添加一些下拉菜單。我的導航欄由通過CSS應用背景圖像的錨標籤組成。 Bootstrap下拉菜單在這種情況下似乎不起作用。唯一能讓它工作的方式是在錨標籤之間添加文本,在這種情況下,文本會觸發下拉菜單,但不會像通過普通CSS期望的錨標籤背景圖那樣:懸停僞類。BootStrap DropDown on <a> tag without text

我的HTML的一個例子:

<a class="logo_master" href="#" data-toggle="dropdown" role="button"></a> 

我的CSS:

.logo_master 
{ 
    display:block; 
    background-image:url(../images/logo_master.png); 
    background-repeat:no-repeat; 
    width:169px; 
    height:39px; 
} 

我也能得到它通過添加錨標記之間的IMG工作,但我使用的是精靈這是以前設置的,我想避免創建所有新圖像並將它們添加到內聯中。

回答

0

使用<i>標記爲你的精靈圖片:

<a href="#" data-toggle="dropdown" role="button"><i class="logo_master" /></a> 
+0

這似乎沒有任何工作。 – jfielaidof 2013-04-23 20:00:34