pebox11
pebox11

Reputation: 3728

Left bootstrap dropdown-toggle button?

I wonder if there exists or if there is a way to make a bootstrap button like the one here, but with the dropdown-toggle to the left. If I just alter the order in the html, then the buttons do show in correct order, but their surfaces do not "snap" right to be totally adjacent as a unified button entity.

Upvotes: 0

Views: 860

Answers (1)

Sean Wessell
Sean Wessell

Reputation: 3510

Is this what you are looking to accomplish?

http://jsfiddle.net/SeanWessell/2mbsLkmw/

HTML:

<!-- Split button -->
<div class="btn-group btn-group-left">
    <button type="button" class="btn btn-danger dropdown-toggle" data-toggle="dropdown" aria-haspopup="true" aria-expanded="false"> <span class="caret"></span>
 <span class="sr-only">Toggle Dropdown</span>

    </button>
    <button type="button" class="btn btn-danger">Action</button>
    <ul class="dropdown-menu">
        <li><a href="#">Action</a>
        </li>
        <li><a href="#">Another action</a>
        </li>
        <li><a href="#">Something else here</a>
        </li>
        <li role="separator" class="divider"></li>
        <li><a href="#">Separated link</a>
        </li>
    </ul>
</div>

Add btn-group-left to the btn-group div.

The add this css to override bootstrap:

CSS:

.btn-group.btn-group-left .dropdown-toggle {
    border-top-right-radius: 0px !important;
    border-bottom-right-radius: 0px !important;
}
.btn-group.btn-group-left .dropdown-toggle+.btn {
    border-top-right-radius: 4px !important;
    border-bottom-right-radius: 4px !important;
}

Upvotes: 1

Related Questions