md-datepicker忽略了自定义边距

时间:2017-12-15 11:51:18

标签: angularjs datepicker angularjs-material

我在我的项目中使用AngularJS Material datepicker,我正在使用一些自定义CSS,md-datepicker不幸忽略了。

Demo

这是一个片段:



angular.module('myApp',['ngMaterial'])

body{background-color:white}
.datePicker{
  margin-top:100px;
}

<head>
  <meta name="viewport" content="width=device-width, initial-scale=1">
  <!-- Angular Material style sheet -->
  <link rel="stylesheet" href="https://ajax.googleapis.com/ajax/libs/angular_material/1.1.0/angular-material.min.css">
</head>
<body ng-app="myApp" >
  <script src="https://ajax.googleapis.com/ajax/libs/angularjs/1.5.5/angular.min.js"></script>
  <script src="https://ajax.googleapis.com/ajax/libs/angularjs/1.5.5/angular-animate.min.js"></script>
  <script src="https://ajax.googleapis.com/ajax/libs/angularjs/1.5.5/angular-aria.min.js"></script>
  <script src="https://ajax.googleapis.com/ajax/libs/angularjs/1.5.5/angular-messages.min.js"></script>

  <!-- Angular Material Library -->
  <script src="https://ajax.googleapis.com/ajax/libs/angular_material/1.1.0/angular-material.min.js"></script>

  <label>User Date</label><br>
<md-datepicker ng-model='userDate' class="datePicker md-primary"></md-datepicker>
  
</body>
&#13;
&#13;
&#13;

1 个答案:

答案 0 :(得分:1)

它正在占用,但display不对。为display设置正确的<md-datepicker>

.datePicker {
  margin-top: 100px;
  display: block;
}

预览

preview

笔:https://codepen.io/anon/pen/ppJXeb