css - 升级 Angular Material 打破了 md-input 换行符

标签 css angularjs angular-material

当我运行旧的 Material 版本时,我有这个登录表单。 我决定升级以使用新功能。

更新后,表单损坏,因此它们不再显示在不同的行上,而是显示在同一行中,如下所示:

更新前

enter image description here

更新后

enter image description here

这是代码:

<div class="form-container">
            <form class="form-horizontal" action="javascript:;">

                <md-input-container md-no-float>
                    <label>Email</label>
                    <input type="email" placeholder="Enter your email" ng-model="email" required>
                </md-input-container>     

                <md-input-container>
                    <label>Password</label>
                    <input type="password" placeholder="Type your password" ng-model="password" required>
                </md-input-container>
    </form>

</div>

有什么问题吗?

最佳答案

只需在 md-input-container 上使用 class="md-block" - CodePen

enter image description here

标记

<div ng-controller="AppCtrl" ng-cloak="" ng-app="MyApp">
  <div class="form-container">
    <form class="form-horizontal" action="javascript:;">

      <md-input-container md-no-float class="md-block">
        <label>Email</label>
        <input type="email" placeholder="Enter your email" ng-model="email" required>
      </md-input-container>     

      <md-input-container class="md-block">
        <label>Password</label>
        <input type="password" placeholder="Type your password" ng-model="password" required>
      </md-input-container>
    </form>
  </div>
</div>

编辑:上述方法是正确的 Angular Material 方法,但如果您想减少两个输入之间的差距,只需使用一点 CSS - CodePen

标记

<md-input-container class="md-block" id="password">

CSS

#password {
  margin-top: -10px
}

关于css - 升级 Angular Material 打破了 md-input 换行符,我们在Stack Overflow上找到一个类似的问题: https://stackoverflow.com/questions/39148371/

相关文章:

javascript - md-select 不更新模型

javascript - 在 Ionic Framework (AngularJS) 中获取和设置复选框

angularjs - 以 Angular 形式设置自定义输入验证

angular-material - 使用 routerLink 时,角度 Material 选项卡动画会中断

angular - 如何在两个组件之间使用 Angular7( Angular Material )拖放

javascript - 正则表达式表现得很奇怪

php - CSS/PHP : how to solve this div float problem/odd even loop in array

html - 为六边形类添加发光效果

css - 使用 css 应用渐变蒙版

html - 全宽画廊,中间有一张图片