简体   繁体   中英

Creating custom.css in Twitter Bootstrap

There is a class "dropdown-menu" in twitter bootstrap eg. <ul class="dropdown-submenu"> . As you observe there is an arrow right to it.How to set the color of arrow to dark when hovered?

You can do it in the following way :

For Dropdown-menu onhover color change:

.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*/
}

Change color of caret when active(Dropdown menu) :

.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*/
 }

For Dropdown Sub menu

.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 onHover color change :

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

  }

The default color of caret is set here and can be changed where mentioned below:

.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;
}

just switch over the glyphicons image?

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

just download colored icon image file from google or glyphicons or change yourself in photoshop

The technical post webpages of this site follow the CC BY-SA 4.0 protocol. If you need to reprint, please indicate the site URL or the original address.Any question please contact:yoyou2525@163.com.

 
粤ICP备18138465号  © 2020-2024 STACKOOM.COM