简体   繁体   English

使用 angular 9 和材料创建一个水平滚动的“滑块”

[英]Create a horizontal scrollable “slider” with angular 9 and material

we have the following component我们有以下组件

<div layout="row">

<div *ngFor="let a of cardsArray">
    <mat-card class="card-card">  
        <mat-card-header>
            <div mat-card-avatar class="example-header-image"></div>
            <mat-card-title>IT29TB92881102020233</mat-card-title>
            <mat-card-subtitle>Deposit</mat-card-subtitle>
        </mat-card-header>

        <mat-card-content>
        <p>
            Valid thru <b>02/23</b>
        </p>
        </mat-card-content>
        <mat-card-actions>
            <button mat-button><mat-icon>list_alt</mat-icon>See Statement</button>
            <button mat-button><mat-icon>share</mat-icon>Copy Requisites</button>
        </mat-card-actions>
    </mat-card>
</div>
</div>

.card-card {
    max-width: 320px;
}


div[layout="row"] {
    overflow: auto;
}

It displays a list of "cards" verically.它会垂直显示“卡片”列表。 How should I create a horizontally scollable list of "cards" and keep it responsive yet?我应该如何创建一个水平可缩放的“卡片”列表并使其保持响应?

Thanks谢谢

Thanks, actually the "issue" was in css, but okay, might be useful for angular starters...谢谢,实际上“问题”在 css 中,但是好的,可能对 angular 初学者有用......

.card-card {
    max-width: 320px;
    margin-top: 10px;
    margin-bottom: 10px;
    margin-right: 5px;
    margin-left: 5px;

}


div[layout="row"] {
    overflow-x: auto;
    display: flex;
    flex-direction: row;
    flex-wrap: nowrap;


}

声明:本站的技术帖子网页,遵循CC BY-SA 4.0协议,如果您需要转载,请注明本站网址或者原文地址。任何问题请咨询:yoyou2525@163.com.

 
粤ICP备18138465号  © 2020-2024 STACKOOM.COM