Angular Materials不会将样式应用于组件 [英] Angular Materials won't apply styles to components

查看:59
本文介绍了Angular Materials不会将样式应用于组件的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!

问题描述

这是一个简单的代码段:

Here is a simple snippet:

.profilebutton  {
  float: right;
}

<!-- PROFILE BUTTON -->
  <div class="col-md-4 profilebuttoncontainer">
    <button md-button [routerLink]="'/welcome/profile'" class="profilebutton">Profile</button>
  </div>

我到底在做什么错?我一直在尝试从Angular Materials设置工具栏,对话框和复选框的样式,但没有一个适用.我可以在垫子(无论如何)下(例如垫子按钮,垫子对话框容器)使用检查器更改样式,这可行,但是如何将其转换为CSS?看来我无权修改mat-(stuff)

What exactly am I doing wrong? I have been trying to style toolbars, dialog boxes, checkboxes all from Angular Materials but none of them apply. I can change the styling with the inspector under mat-(whatever) like mat-button, mat-dialog-container, and that works, but how do I translate that to css? It seems I don't have access to modifying the mat-(stuff)

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

All I want to do is stick an md-button to the right side of a container. Super simple.

推荐答案

您的代码应该可以正常工作.参见下面的代码,

Your code should work as expected. See the below code,

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

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

Note : Add the stylesheet reference at the component level using below line

styleUrls:[`....`]

实时演示

LIVE DEMO

这篇关于Angular Materials不会将样式应用于组件的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!

查看全文
登录 关闭
扫码关注1秒登录
发送“验证码”获取 | 15天全站免登陆