1

twitter bootstrap 中有一个“下拉菜单”类,例如。<ul class="dropdown-submenu">. 正如您所观察到的那样,它右侧有一个箭头。悬停时如何将箭头的颜色设置为深色?

4

2 回答 2

1

您可以通过以下方式执行此操作:

对于下拉菜单悬停颜色更改:

.navbar .nav li.dropdown > a:hover .caret, .navbar .nav li.dropdown > a:focus .caret {
border-bottom-color: red;/*change color to your liking*/
border-top-color: red;/*change color to your liking*/
}

激活时更改插入符号的颜色(下拉菜单):

.navbar .nav li.dropdown.open > .dropdown-toggle .caret, .navbar .nav li.dropdown.active > .dropdown-toggle .caret, .navbar .nav li.dropdown.open.active > .dropdown-toggle .caret {
border-bottom-color: #008745;/*change color*/
border-top-color: #008745;/*change color*/
 }

对于下拉子菜单

.dropdown-submenu > a:after {
border-color: transparent transparent transparent #000000;/*change here */
border-style: solid;
border-width: 5px 0 5px 5px;
content: " ";
display: block;
float: right;
height: 0;
margin-right: -10px;
margin-top: 5px;
width: 0;
}

悬停颜色变化的下拉子菜单:

.dropdown-submenu:hover > a:after{
      border-left-color:#fff; /* change the color to anything of your choice*/

  }

插入符号的默认颜色在此处设置,并且可以在下面提到的地方进行更改:

.caret {
border-left: 4px solid transparent;
border-right: 4px solid transparent;
border-top: 4px solid #FFFFFF; /* change the color to anything of ur liking */
content: "";
display: inline-block;
height: 0;
vertical-align: top;
width: 0;
}
于 2013-03-05T12:19:19.700 回答
0

只需切换 glyphicons 图像?

.dropdown-submenu:hover{
  i{
    background-image: url("../images/bootstrap/glyphicons-halflings-white.png");
  }

只需从google或 glyphicons下载彩色图标图像文件或在 Photoshop 中更改自己

于 2013-03-05T12:19:22.297 回答