我有一个 Angular 元素,我在其中使用 Angular Material 和 Material 表。
似乎我表格中的所有文本都应用了 10px 的顶部和底部边距,这是由于一个名为 .ng-tns-c5-1 或 .ng-tns-c6-1 等的类。
如果不检查元素、找到该类然后使用 CSS 更改该边距,我无法找到更改这些边距的方法。
但在对应用程序上的其他元素进行一些更改后,.ng-tns-c6-1(例如)更改为:.ng-tns-c4-0,然后我必须更改它。问题是我现在已经这样做了 5-6 次,而且非常痛苦。
因为表格有很多无用的空白区域,整体看起来很糟糕。
那个类是什么?我该怎么做才能确保边距保持在我设置的 2-3 像素?
这是我的 CSS 中的类型:
.ng-tns-c5-1 {
margin-top: 2px !important;
margin-bottom: 2px !important;
}
.ng-tns-c5-0 {
margin-top: 2px !important;
margin-bottom: 2px !important;
}
.ng-tns-c6-1 {
margin-top: 2px !important;
margin-bottom: 2px !important;
}
.ng-tns-c4-0 {
margin-top: 2px !important;
margin-bottom: 2px !important;
}
最佳答案
您可以使用以下选择所有当前和 future 的元素。
[id*='ng-tns-c'] {
}
关于html - Angular Material ng-tns 类更改了我表中元素的边距,可以使用 CSS 更改边距但随后应用了 ng-tns 的另一个变体吗?,我们在Stack Overflow上找到一个类似的问题: https://stackoverflow.com/questions/51896805/