【问题标题】:Increase height on angular material 2 moves placeholder增加角材料的高度 2 移动占位符
【发布时间】:2017-07-12 22:44:48
【问题描述】:

我正在尝试通过设置来自 css 的输入的 height 属性来增加材料 2 输入控件的大小

<input mdInput placeholder="Favorite food" class="search-grid-input">

.search-grid-input {
    height:30px!important;
}

我在下图的右侧得到以下信息:

【问题讨论】:

  • 身高变高了,你的问题是什么?
  • 对不起。如果您看到屏幕截图,占位符会位于顶部而不是停留在输入中心

标签: css angular angular-material2


【解决方案1】:

版本 1: 您应该增加输入字段的字体大小,这将自动覆盖该区域。

md-input-container {
  font-size: 25px;
}

版本 2: 你应该使用文本区域。

版本 3: 从顶部指定占位符空间:

.mat-input-placeholder-wrapper {
  top: 10px;
}

注意:我在使用 beta.8 版本时复制了类名。

【讨论】:

  • 感谢我使用了版本 1
猜你喜欢
  • 2019-08-01
  • 2019-03-10
  • 1970-01-01
  • 1970-01-01
  • 1970-01-01
  • 2017-01-07
  • 2018-11-16
  • 1970-01-01
  • 2017-12-29
相关资源
最近更新 更多