Logo Questions Linux Laravel Mysql Ubuntu Git Menu
 

adding the arrow to dropdown pills for twitter bootstrap?

I got the twitter bootstrap dropdown buttons successfully working, but I have a tiny problem. The black navbar here:

http://twitter.github.com/bootstrap/javascript.html#dropdowns

It has a neat little arrow when the dropdown opens, right? Well, I'm using the pills right below and they don't have that arrow. It seems the arrow is only included when using the navbar, which I don't need.

Has anyone figured out a way to add the arrows to the pills? :(

like image 706
user1227914 Avatar asked Jul 24 '12 14:07

user1227914


People also ask

How do I add a drop down list in Bootstrap?

Adding Dropdowns via JavaScript. You may also add dropdowns manually using the JavaScript — just call the dropdown() Bootstrap method with the id or class selector of the link or button element in your JavaScript code.

What are Bootstrap dropdown pills?

Bootstrap dropdowns are the toggleable menu for displaying a list of data, made interactive with the JavaScript plugin. We can toggle the list by clicking. Along with this, we can use bootstrap component pills with a dropdown with the bootstrap menu as pills which makes it possible to display.

What is arrow up down left right icons in Bootstrap?

This tutorial covers Bootstrap Arrow Up Down left right icons list with class names. These icons can be used in UX design as well as pages. It can be customize these icons using css styles based on our needs.

How to create tab based navigation using Twitter Bootstrap?

You may create tab based dropdown navigation using Twitter Bootstrap. There are four CSS classes - .dropdown, .dropdown-toggle, .dropdown-menu and .caret which you need in addition to the .nav and .nav-tabs classes for that.


Video Answer


3 Answers

Assuming you're referring to the white arrow that points upward when a menu item is clicked, the style you're looking for is on line 3907 in bootstrap.css:

.navbar .dropdown-menu::after {
  position: absolute;
  top: -6px;
  left: 10px;
  display: inline-block;
  border-right: 6px solid transparent;
  border-bottom: 6px solid white;
  border-left: 6px solid transparent;
  content: '';
}

You can try copying this style and removing the .navbar portion of the style declaration and modify it to fit your code.

like image 80
Jason Towne Avatar answered Oct 01 '22 09:10

Jason Towne


Here's a refinement to Jason Towne's answer.

This works correctly if the menu has been pulled to the right.

.dropdown-menu-arrow::before {
    border-bottom: 7px solid rgba(0, 0, 0, 0.2);
    border-left: 7px solid transparent;
    border-right: 7px solid transparent;
    content: "";
    display: inline-block;
    left: 9px;
    position: absolute;
    top: -7px;
}

.dropdown-menu-arrow::after {
    border-bottom: 6px solid #FFFFFF;
    border-left: 6px solid transparent;
    border-right: 6px solid transparent;
    content: "";
    display: inline-block;
    left: 10px;
    position: absolute;
    top: -6px;
}

.btn-group.pull-right > .dropdown-menu-arrow::before {
    left: inherit;
    right: 9px;
}

.btn-group.pull-right > .dropdown-menu-arrow::after {
    left: inherit;
    right: 10px;
}

Here's an example of usage.

<div class="btn-group pull-right">
    <a href="#" data-toggle="dropdown" class="btn dropdown-toggle">
    Actions
    <span class="caret"></span>
    </a>
    <ul class="dropdown-menu dropdown-menu-arrow">
        <li>...</li>
    </ul>
</div>
like image 22
Umar Farooq Khawaja Avatar answered Oct 01 '22 08:10

Umar Farooq Khawaja


Not sure what the pills are, but if you have bootstrap you add the arrows by simply putting this anywhere in your code.

<b class="caret"></b>

Is that what you meant?

like image 31
Mark Pieszak - Trilon.io Avatar answered Oct 01 '22 08:10

Mark Pieszak - Trilon.io