https://plnkr.co/edit/aUYfOBJ0MdywKW2pphOM?p=preview材料2:难度定型宽度MD-选择
<md-select placeholder="food" style=""><!-- no width stylings that work -->
<md-option *ngFor="let food of foods" [value]="food.value">
{{ food.viewValue }}
</md-option>
</md-select>
请参阅上述plunker。我在用占位符'food'设计md-select的宽度方面遇到了很多困难。为什么我不能在md-select标签中做一个style =“”?我曾尝试针对这个同样的div与一个没有反应的类。我也尝试过使用在Chrome,Firefox和IE的F12工具中可见的.md-select-trigger类。没有。
工作的唯一方法是取消选择浏览器工具区中可用的.md-select-trigger类的最小宽度或弹性空间。
我不知道我在这里处理的是什么。
不应该有任何东西阻止你使用'style =“/ *你想要什么* /”',例如[this plnkr](https://plnkr.co/edit/Wqg1vvxE2DINhetzL28e?p=preview) – Aeveus
@Aeveus不,我不认为它是一件沉闷的事情。我的本地同样的事情。我曾尝试过style =“min-width:10px”,style =“width:10px”等,以显示宽度的明显变化,没有任何东西。 –
您试图更改当前组件范围之外的内容。 Angular [查看封装](https://angular.io/docs/ts/latest/guide/component-styles.html#!#view-encapsulation),这意味着此组件中定义的样式不会渗入不同的组件。您可以通过全局样式文件覆盖此视图,或者关闭视图封装(尽管不建议这样做)。 – Aeveus