Reputation: 131
I have an md-card that consists of an md-header and scrollable md-card-content. As the scrollable content gets taller, the header gets smaller and smaller for some reason. The width of the card can change and the header can possibly wrap around to 2 or 3 lines so a min-height on the header isn't a solution. The problem exists in latest IE and Chrome, not FF.
Click The "Add 5 Rows" button a few times to see the header shrink
http://plnkr.co/edit/wgBKnXh7FSn1VLO8mST0?p=preview
<html>
<head>
<title>angular material</title>
<link rel="stylesheet" href="https://rawgit.com/angular/bower-material/master/angular-material.css">
</head>
<body ng-app="app" ng-controller="ctrl" layout="column" layout-fill>
<md-card style="height: 200px; width: 500px">
<md-card-header style="border-bottom: 1px solid grey">
<md-card-header-text>
<span class="md-title">Long Header Long Header Long Header Long Header Long Header Long Header Long Header Long Header </span>
</md-card-header-text>
</md-card-header>
<md-content-card style="overflow-y: auto" >
<ul>
<li ng-repeat="x in getArray() track by $index"></li>
</ul>
</md-content-card>
</md-card>
<button style="width: 200px" ng-click="addRows()">
Add 5 Rows
</button>
<!-- Angular Material Dependencies -->
<script src="https://ajax.googleapis.com/ajax/libs/angularjs/1.3.14/angular.js"></script>
<script src="https://ajax.googleapis.com/ajax/libs/angularjs/1.3.14/angular-animate.js"></script>
<script src="https://ajax.googleapis.com/ajax/libs/angularjs/1.3.14/angular-aria.js"></script>
<!-- Angular Material Javascript using RawGit to load directly from `bower-material/master` -->
<script src="https://rawgit.com/angular/bower-material/master/angular-material.js"></script>
<script>
var app = angular.module('app', ['ngMaterial']);
app.controller("ctrl", function($scope) {
$scope.rows = 0;
$scope.addRows = function() {
$scope.rows += 5;
};
$scope.getArray = function() {
return new Array($scope.rows);
};
});
</script>
</body>
</html>
Upvotes: 3
Views: 12326
Reputation: 12813
You just need to move the fixed height declaration from md-card
to md-content-card
- Plunker
Markup
<md-card style="width: 500px">
<md-card-header style="border-bottom: 1px solid grey">
<md-card-header-text>
<span class="md-title">Long Header Long Header Long Header Long Header Long Header Long Header Long Header Long Header </span>
</md-card-header-text>
</md-card-header>
<md-content-card style="height: 200px; overflow-y: auto" >
<ul>
<li ng-repeat="x in getArray() track by $index"></li>
</ul>
</md-content-card>
</md-card>
Upvotes: 12