I have a page with some AngularJS Material cards that need to be arranged in two columns. The last card should show with the full width below the two columns. However, card #3 and #4 (depending on the width) overlap with the final card. I have spent hours debugging this but just cannot find out why this is happening.
Here is my code:
angular.module('app', ['ngMaterial']).controller('ctrl', function() {});
<!-- Angular Material Stylesheet -->
<link rel="stylesheet" href="https://cdnjs.cloudflare.com/ajax/libs/angular-material/1.1.1/angular-material.min.css">
<!-- Angular Material requires Angular.js Libraries -->
<script src="https://cdnjs.cloudflare.com/ajax/libs/angular.js/1.5.9/angular.min.js"></script>
<script src="https://cdnjs.cloudflare.com/ajax/libs/angular-i18n/1.5.9/angular-locale_de-de.min.js"></script>
<script src="https://cdnjs.cloudflare.com/ajax/libs/angular.js/1.5.9/angular-route.min.js"></script>
<script src="https://cdnjs.cloudflare.com/ajax/libs/angular.js/1.5.9/angular-animate.min.js"></script>
<script src="https://cdnjs.cloudflare.com/ajax/libs/angular.js/1.5.9/angular-aria.min.js"></script>
<script src="https://cdnjs.cloudflare.com/ajax/libs/angular.js/1.5.9/angular-messages.min.js"></script>
<script src="https://cdnjs.cloudflare.com/ajax/libs/angular.js/1.5.9/angular-sanitize.min.js"></script>
<script src="https://cdnjs.cloudflare.com/ajax/libs/angular.js/1.5.9/angular-cookies.min.js"></script>
<!-- Angular Material Library -->
<script src="https://cdnjs.cloudflare.com/ajax/libs/angular-material/1.1.1/angular-material.min.js"></script>
<div ng-app="app" ng-controller="ctrl" ng-cloak>
<form name="couponform" novalidate>
<div layout="column" layout-gt-sm="row">
<div flex="auto" flex-gt-sm="60">
<md-card>
<md-card-title>
<md-card-title-text>
<span class="md-headline">Card left #1</span>
</md-card-title-text>
</md-card-title>
<md-card-content>
<p>Some content</p>
<p>Some content</p>
<p>Some content</p>
<p>Some content</p>
<p>Some content</p>
<p>Some content</p>
</md-card-content>
</md-card>
<md-card>
<md-card-title>
<md-card-title-text>
<span class="md-headline">Card left #2</span>
</md-card-title-text>
</md-card-title>
<md-card-content>
<p>Some content</p>
<p>Some content</p>
<p>Some content</p>
<p>Some content</p>
<p>Some content</p>
<p>Some content</p>
</md-card-content>
</md-card>
<md-card>
<md-card-title>
<md-card-title-text>
<span class="md-headline">Card left #3</span>
</md-card-title-text>
</md-card-title>
<md-card-content>
<p>Some content</p>
<p>Some content</p>
<p>Some content</p>
<p>Some content</p>
<p>Some content</p>
<p>Some content</p>
</md-card-content>
</md-card>
<md-card>
<md-card-title>
<md-card-title-text>
<span class="md-headline">Card left #4</span>
</md-card-title-text>
</md-card-title>
<md-card-content>
<p>Some content</p>
<p>Some content</p>
<p>Some content</p>
<p>Some content</p>
<p>Some content</p>
<p>Some content</p>
</md-card-content>
</md-card>
</div>
<div flex="auto" flex-gt-sm="40">
<md-card>
<md-card-title>
<md-card-title-text>
<span class="md-headline">Card right</span>
</md-card-title-text>
</md-card-title>
<md-card-content>
<p>Some content</p>
<p>Some content</p>
<p>Some content</p>
<p>Some content</p>
<p>Some content</p>
<p>Some content</p>
</md-card-content>
</md-card>
</div>
</div>
<md-card>
<md-card-title>
<md-card-title-text>
<span class="md-headline">Card below</span>
</md-card-title-text>
</md-card-title>
<md-card-content>
<p>This should be below everything else</p>
</md-card-content>
<md-card-actions layout="row" layout-align="end center">
<md-button ng-click="submit()">Buchen</md-button>
</md-card-actions>
</md-card>
</form>
</div>
Here is the relevant part of the output:
Actually, if you run the code here it comes out as expected, but if it's a separate HTML file, it does not. Very strange.
You are missing
<!DOCTYPE html>
, without this the browser is rendering the page in quirks mode.See Why do I need a doctype? (What does it do)