Skip to content

Commit b105039

Browse files
crisbetoandrewseguin
authored andcommitted
fix(tabs): improved vertical alignment of tab label (#5771)
Uses inline flex to align the tab label content. This is more reliable and more flexible. It also allows us to have multi-line text in the tabs, if we decide that we want to support it.
1 parent 39c3e42 commit b105039

File tree

2 files changed

+4
-3
lines changed

2 files changed

+4
-3
lines changed

src/lib/tabs/_tabs-common.scss

Lines changed: 4 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -1,19 +1,21 @@
11
@import '../core/style/variables';
22

33
$mat-tab-bar-height: 48px !default;
4-
54
$mat-tab-animation-duration: 500ms !default;
65

76
// Mixin styles for labels that are contained within the tab header.
87
@mixin tab-label {
9-
line-height: $mat-tab-bar-height;
108
height: $mat-tab-bar-height;
119
padding: 0 12px;
1210
cursor: pointer;
1311
box-sizing: border-box;
1412
opacity: 0.6;
1513
min-width: 160px;
1614
text-align: center;
15+
display: inline-flex;
16+
justify-content: center;
17+
align-items: center;
18+
white-space: nowrap;
1719

1820
&:focus {
1921
outline: none;

src/lib/tabs/tab-nav-bar/tab-nav-bar.scss

Lines changed: 0 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -13,7 +13,6 @@
1313
// Wraps each link in the header
1414
.mat-tab-link {
1515
@include tab-label;
16-
display: inline-block;
1716
vertical-align: top;
1817
text-decoration: none; // Removes anchor underline styling
1918
position: relative;

0 commit comments

Comments
 (0)