答案 0 :(得分:1)
我在css伪类之前和之后使用了它,但是是为了减少一定数量的mat-ink-bar宽度。请参见下面的SCSS代码
mat-ink-bar {
&:before,
&:after {
content: "";
height: 2px;
width: 20px;
background-color: white;
position: absolute;
left: 0;
}
&:after {
left: initial;
right: 0;
}
}
答案 1 :(得分:1)
我通过删除最小宽度和.mat-tab-label类的填充实现了这一点。 并按照我的要求增加边距,以使标签分开。 用作mat-ink-bar时使用mat-tab-label的宽度,该宽度设置为min-width为160px;
答案 2 :(得分:0)
只需删除现有mat-link-bar
的背景色(使用background-color: transparent
),然后使用pseudo
类创建新样式即可。
.mat-ink-bar {
background-color: transparent;
&::before {
content: '';
display: block;
width: 90%;
background-color: #47a1f6;
height: 6px;
border-bottom-right-radius: 70px;
border-bottom-left-radius: 70px;
left: 5%;
position: relative;
}
}
看起来像这样: