【问题标题】:Angular Materials won't apply styles to componentsAngular Materials 不会将样式应用于组件
【发布时间】:2018-01-27 15:13:50
【问题描述】:

这是一个简单的sn-p:

.profilebutton  {
  float: right;
}
<!-- PROFILE BUTTON -->
  <div class="col-md-4 profilebuttoncontainer">
    <button md-button [routerLink]="'/welcome/profile'" class="profilebutton">Profile</button>
  </div>

我到底做错了什么?我一直在尝试使用 Angular Materials 设置工具栏、对话框、复选框的样式,但它们都不适用。我可以使用 mat-(whatever) 下的检查器更改样式,例如 mat-button、mat-dialog-container,这很有效,但是如何将其转换为 css?看来我无权修改垫子-(东西)

我想要做的就是在容器的右侧粘贴一个 md 按钮。超级简单。

【问题讨论】:

  • @Vega 这显然是 Angular,因为材质按钮具有 md-button 属性而不是元素。
  • 你能支持这个答案吗?

标签: css angular angular-material2


【解决方案1】:

您的代码应该可以按预期工作。看下面的代码,

<div class="profilebuttoncontainer">
     <button md-button class="temp-class">Click me!</button>
</div>

注意:使用下面的行在组件级别添加样式表引用

styleUrls:[`....`]

LIVE DEMO

【讨论】:

    猜你喜欢
    • 1970-01-01
    • 2021-06-17
    • 1970-01-01
    • 1970-01-01
    • 2019-02-14
    • 2021-12-10
    • 1970-01-01
    • 1970-01-01
    • 2016-04-16
    相关资源
    最近更新 更多