ng-zorro等组件默认样式的修改

在项目中修改ng-zorro组件默认样式的一些方法:

  • 类名等 前加::ng-deep
  • 类名等 前加:root
  • 类名等 前加:host /deep/
::ng-deep .ant-spin-dot i {
  background-color: #4c7bff;
}
:host ::ng-deep .ant-spin-dot i {
  background-color: #4c7bff;
}
:root .ant-select-dropdown {
  background-color: #1F273E;
  font-size: 14px;
  margin-top: 16px;
}
:host /deep/ .ant-spin-dot i {
  background-color: #4c7bff;
}

注意:上面三种方法可分别尝试一下,不同情况下其中之一会生效。

截止目前最新的7.0.0-rc.0 版本

table组件tbody中的td中的内容超出时默认会换行,想要实现xxxx...的效果需要一个hack:

::ng-deep .ant-table-tbody > tr > td {
  max-width: 0;
  white-space: nowrap;
}
最后编辑于
©著作权归作者所有,转载或内容合作请联系作者
平台声明:文章内容(如有图片或视频亦包括在内)由作者上传并发布,文章内容仅代表作者本人观点,简书系信息发布平台,仅提供信息存储服务。

推荐阅读更多精彩内容