}
.dropdown-toggle {
+ white-space: nowrap;
+
// Generate the caret automatically
- @include caret;
+ @include caret();
}
// The dropdown menu
display: none; // none by default, but block on "open" of the menu
float: left;
min-width: $dropdown-min-width;
- padding: $dropdown-padding-y 0;
+ padding: $dropdown-padding-y $dropdown-padding-x;
margin: $dropdown-spacer 0 0; // override default ul
- font-size: $font-size-base; // Redeclare because nesting can cause inheritance issues
- color: $body-color;
+ @include font-size($dropdown-font-size);
+ color: $dropdown-color;
text-align: left; // Ensures proper alignment if parent has it changed (e.g., modal footer)
list-style: none;
background-color: $dropdown-bg;
@include box-shadow($dropdown-box-shadow);
}
-@each $breakpoint in map-keys($grid-breakpoints) {
- @include media-breakpoint-up($breakpoint) {
- $infix: breakpoint-infix($breakpoint, $grid-breakpoints);
-
- .dropdown-menu#{$infix}-right {
- right: 0;
- left: auto;
- }
- }
-}
-
@each $breakpoint in map-keys($grid-breakpoints) {
@include media-breakpoint-up($breakpoint) {
$infix: breakpoint-infix($breakpoint, $grid-breakpoints);
right: auto;
left: 0;
}
+
+ .dropdown-menu#{$infix}-right {
+ right: 0;
+ left: auto;
+ }
}
}
// Dividers (basically an `<hr>`) within the dropdown
.dropdown-divider {
- @include nav-divider($dropdown-divider-bg);
+ @include nav-divider($dropdown-divider-bg, $dropdown-divider-margin-y, true);
}
// Links, buttons, and more within the dropdown menu
font-weight: $font-weight-normal;
color: $dropdown-link-color;
text-align: inherit; // For `<button>`s
+ text-decoration: if($link-decoration == none, null, none);
white-space: nowrap; // prevent links from randomly breaking onto new lines
background-color: transparent; // For `<button>`s
border: 0; // For `<button>`s
- &:first-child {
- @include border-top-radius($dropdown-inner-border-radius);
- }
+ // Prevent dropdown overflow if there's no padding
+ // See https://github.com/twbs/bootstrap/pull/27703
+ @if $dropdown-padding-y == 0 {
+ &:first-child {
+ @include border-top-radius($dropdown-inner-border-radius);
+ }
- &:last-child {
- @include border-bottom-radius($dropdown-inner-border-radius);
+ &:last-child {
+ @include border-bottom-radius($dropdown-inner-border-radius);
+ }
}
- @include hover-focus {
+ @include hover-focus() {
color: $dropdown-link-hover-color;
text-decoration: none;
@include gradient-bg($dropdown-link-hover-bg);
// Dropdown section headers
.dropdown-header {
display: block;
- padding: $dropdown-padding-y $dropdown-item-padding-x;
+ padding: $dropdown-header-padding;
margin-bottom: 0; // for use with heading elements
- font-size: $font-size-sm;
+ @include font-size($font-size-sm);
color: $dropdown-header-color;
white-space: nowrap; // as with > li > a
}