Skip to content

Commit 8a0b8b6

Browse files
committed
Merge pull request #18789 from twbs/fix-18733-more
Prevent breadcrumb separator from getting underlined on hover when not using <ol> markup
2 parents 3a2f045 + 86caa76 commit 8a0b8b6

File tree

1 file changed

+16
-0
lines changed

1 file changed

+16
-0
lines changed

scss/_breadcrumb.scss

Lines changed: 16 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -10,13 +10,29 @@
1010
.breadcrumb-item {
1111
float: left;
1212

13+
// The separator between breadcrumbs (by default, a forward-slash: "/")
1314
+ .breadcrumb-item::before {
15+
display: inline-block; // Suppress underlining of the separator in modern browsers
1416
padding-right: $breadcrumb-item-padding;
1517
padding-left: $breadcrumb-item-padding;
1618
color: $breadcrumb-divider-color;
1719
content: "#{$breadcrumb-divider}";
1820
}
1921

22+
// When not using <ul> markup, browsers normally underline the ::before pseudo-element
23+
// (the separator between the breadcrumbs) when the user hovers over its originating breadcrumb <a> element.
24+
// In modern browsers, this underline can be suppressed by setting `display:inline-block` on the pseudo-element.
25+
// (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.)
26+
// IE9-11 suffer from a bug which prevents that solution from working.
27+
// 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.
28+
// This tricks IE into suppressing the underline.
29+
+ .breadcrumb-item:hover::before {
30+
text-decoration: underline; // Part 1 of IE9-11 hack to suppress the underline
31+
}
32+
+ .breadcrumb-item:hover::before {
33+
text-decoration: none; // Suppress underlining of the separator in IE9-11 (requires an earlier setting of `text-decoration:underline`)
34+
}
35+
2036
&.active {
2137
color: $breadcrumb-active-color;
2238
}

0 commit comments

Comments
 (0)