如何调整角度材料的长度md-input

时间:2017-04-02 12:25:51

标签: angularjs angular-material angular-material2

如何调整md输入组件的长度? size / width属性似乎不起作用。 在下面的例子中,我试图使用块号

来制作相同长度的楼层单元
test

2 个答案:

答案 0 :(得分:1)

我也在努力设计ng2材质设计元素,但我找到了一种如何克服这一点的方法 - 只需将类添加到md-list-element并设置此类的样式。就像那样:

<md-list-item class="same-width"> <md-input [(ngModel)]="customer.custEmail" name="custEmail" type="text" placeholder="Email address"></md-input> </md-list-item> <md-list-item class="same-width"> <md-input [(ngModel)]="customer.custDisplayName" name="custDisplayName" type="text" placeholder="Display Name"></md-input> </md-list-item> ...

在css中

.same-width { width: 300px; }

其他选项是通过材料自定义修改md-list-item元素。

答案 1 :(得分:0)

我没有使用Angular Material 2,而是&#34; size&#34;属性似乎对我有用

  <md-list-item>
     <md-input-container>
         <label>Inputfield</label>
         <input type="text" ng-model="color" size="10">
     </md-input-container>
  </md-list-item>
相关问题