【发布时间】:2019-03-25 22:36:17
【问题描述】:
我正在尝试让有角材质的卡片具有粘性。问题是它似乎不起作用,我不明白为什么。
是不是因为父组件有一个 FxLayout ?我无法让我的卡片粘起来,这里是我的代码:
HTML
<section fxLayout="row" fxLayoutGap="5%">
<article class="progress-card" fxFlex="30">
<mat-card fxLayout="column" fxLayoutAlign="center center">
<mat-card-title><h2>PROGRESSION</h2></mat-card-title>
<mat-card-content>
<p>Text here</p>
</mat-card-content>
</mat-card>
</article>
<article fxFlex="70" fxLayout="column">
<mat-card>
<mat-card-title><h2>CONTENT</h2></mat-card-title>
<mat-card-content>
<p>Text here</p>
</mat-card-content>
</mat-card>
</article>
</section>
CSS
.progress-card {
position: -webkit-sticky; /* Safari */
position: sticky;
top: 0;
}
当我向下滚动阅读其他卡片内容时,我想让“进度卡”保持在屏幕顶部。
感谢您的帮助和时间。
【问题讨论】:
标签: css angular angular-material sticky angular-flex-layout