在第一张图片中,一切正常。

css - 使 Angular Material 的md卡不重叠-LMLPHP

但是,如果我将浏览器的宽度稍大一些,结果如下:

css - 使 Angular Material 的md卡不重叠-LMLPHP

每个md卡都与下一张md卡重叠,并加上y溢出。此问题仅在xs分辨率上。这是我的html:

<div ng-view="" flex="" class="ng-scope flex">
    <md-content layout-xs="column" layout="row" class="md-padding ng-scope layout-xs-column layout-row">
        <div layout="column" layout-gt-xs="row" layout-wrap="" infinite-scroll="ctrl.nextArticles()" infinite-scroll-disabled="ctrl.isBusy || ctrl.isEnd" infinite-scroll-distance="1" class="layout-wrap ng-isolate-scope layout-gt-xs-row layout-column">
            <!-- ngRepeat: article in ctrl.articles -->
            <div ng-repeat="article in ctrl.articles" class="post ng-scope flex-xs-100 flex-xl-20 flex-sm-50 flex-md-33 flex-lg-25" flex-xs="100" flex-sm="50" flex-md="33" flex-lg="25" flex-xl="20">
                <md-card>
                    <md-card-header>
                        <md-card-avatar>
                            <img src="/images/sidenav-icons/Bomb.svg">
                        </md-card-avatar>
                        <md-card-header-text>
                            <span class="md-title ng-binding">FakeTitle147</span>
                            <span class="md-subhead ng-binding">FakeRubric3</span>
                        </md-card-header-text>
                    </md-card-header>
                        <img ng-src="/images/test-img.jpg" alt="*ALT*" class="md-card-image" src="/images/test-img.jpg">
                    <md-card-title>
                        <md-card-title-text>
                            <span class="md-headline">Card header</span>
                        </md-card-title-text>
                    </md-card-title>
                    <md-card-content>
                        <p>
                            The titles
                        </p>
                    </md-card-content>
                    <button class="md-button md-ink-ripple" type="button" ng-transclude="" ng-click="ctrl.showArticle(article._id)" aria-label="Button">
                        <span class="ng-scope">Button</span>
                    </button>
                </md-card>


我没有自定义的CSS(只有背景色)。感谢您的想法。

最佳答案

问题出在layout="column"中。我只是替换了这个:

<div layout="column" layout-gt-xs="row" layout-wrap="" ...


对此:

<div layout="row" layout-wrap="" ...


这个解决方案对我来说还可以。

10-04 22:55