aboutsummaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorMark Otto <[email protected]>2016-01-17 15:45:02 -0800
committerMark Otto <[email protected]>2016-01-17 15:45:02 -0800
commit8a0b8b6b032933c990d2cbdfaf3c424c25658840 (patch)
treedb65e08533a11e3da07a213440da93d71b410930
parent3a2f0456bf2d2835b624397bcb9cb03d68390a79 (diff)
parent86caa76f547a3ad44596aa9949e101c5c69a67d8 (diff)
downloadbootstrap-8a0b8b6b032933c990d2cbdfaf3c424c25658840.tar.xz
bootstrap-8a0b8b6b032933c990d2cbdfaf3c424c25658840.zip
Merge pull request #18789 from twbs/fix-18733-more
Prevent breadcrumb separator from getting underlined on hover when not using <ol> markup
-rw-r--r--scss/_breadcrumb.scss16
1 files changed, 16 insertions, 0 deletions
diff --git a/scss/_breadcrumb.scss b/scss/_breadcrumb.scss
index 5ccca354c..d5fba04a4 100644
--- a/scss/_breadcrumb.scss
+++ b/scss/_breadcrumb.scss
@@ -10,13 +10,29 @@
.breadcrumb-item {
float: left;
+ // The separator between breadcrumbs (by default, a forward-slash: "/")
+ .breadcrumb-item::before {
+ display: inline-block; // Suppress underlining of the separator in modern browsers
padding-right: $breadcrumb-item-padding;
padding-left: $breadcrumb-item-padding;
color: $breadcrumb-divider-color;
content: "#{$breadcrumb-divider}";
}
+ // When not using <ul> markup, browsers normally underline the ::before pseudo-element
+ // (the separator between the breadcrumbs) when the user hovers over its originating breadcrumb <a> element.
+ // In modern browsers, this underline can be suppressed by setting `display:inline-block` on the pseudo-element.
+ // (Why doesn't simply setting `text-decoration:none` on the pseudo-element work? Because that's how text-decoration propagation has been spec'd in CSS.)
+ // IE9-11 suffer from a bug which prevents that solution from working.
+ // For them, we apply a hack where we first set `text-decoration:underline` and then later set `text-decoration:none`, both on the pseudo-element.
+ // This tricks IE into suppressing the underline.
+ + .breadcrumb-item:hover::before {
+ text-decoration: underline; // Part 1 of IE9-11 hack to suppress the underline
+ }
+ + .breadcrumb-item:hover::before {
+ text-decoration: none; // Suppress underlining of the separator in IE9-11 (requires an earlier setting of `text-decoration:underline`)
+ }
+
&.active {
color: $breadcrumb-active-color;
}