将样式应用于Material2组件不起作用 [英] Applying style to Material2 component does not work

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

问题描述

我有一个<md-input>元素:

<md-input class="filter-name-input" [(ngModel)]="name" placeholder="Name"></md-input>

并且正在尝试通过CSS对其应用样式:

And am trying to apply styling to it via a CSS:

md-input {
    height: 2000000px;
}

我没有看到在浏览器调试器中应用的样式.我这样做不当吗?

I'm not seeing the style being applied in the browser debugger. Am I doing this improperly?

推荐答案

没有,你做对了,看看这个矮子

No you are doing right have a look at this plunker

工作示例

<md-input #startDate
          required
          name="startDate"
          placeholder="startDate">
</md-input>
</p> 

<style>
  md-input{height:1000px; background:red;}
</style>

实际上css高度已应用到您的组件,但由于白色背景而可能不可见,请参阅随附的插销,对我来说工作正常.

actually css height is being applied to your component but may not be visible due to white background, see in the attached plunker its working fine for me.

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

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