我正在使用Angular Mat Card,并且我有一个按钮,每次单击该按钮时都会在数据库中创建新卡,但是新卡显示在现有卡的底部,而两者之间没有任何间隙,因此如果您伙计们可以帮助我弄清楚如何使差距/利润率很棒。谢谢
This is what it look like right now
This is what I want to look like
.clickable {
cursor: pointer;
}
.mat-chip {
background-color: #DFDFDF;
text-align: left;
font: Regular 16px/21px Roboto;
letter-spacing: 0.29px;
color: #000000DE;
opacity: 1;
border-radius: 18px;
opacity: 1;
}
.mat-card {
margin-left: -10px;
padding: 0;
margin-bottom: 20px;;
width: 350px;
height: auto;
cursor: pointer;
}
.chipMargin{
margin-left: 5%;
margin-right: 5%;
}
.mat-chip-list {
display: table-row;
flex-direction: column;
}
@media screen and (min-width:768px)
{
.divider {
height: 90%;
position: absolute;
left: 900px;
right: 830px;
top: 40px;
}
.column {
float: left;
width: 950px;
padding: 10px;
margin-left: 30px;
margin-top: 10px;
}
.column2 {
width: 730px;
float: right;
right: 70px;
position: absolute;
}
.row:after {
content: "";
display: table;
clear: both;
}
.inline-block {
display: inline-block;
}
}
<head>
<meta name="viewport" content="width=device-width, initial-scale=1">
</head>
<h2 style="font-size: 1.5em; margin-left: 40px; margin-top: 20px; color: white;">Home</h2>
<div matSubheader>
<span style="font-size: 1.2em; margin-left: 20px; color: white;">My Workspaces</span>
<button mat-stroked-button color="accent" matTooltip="New Workspace" (click)="newWorkspaceClick()">
<mat-icon>add</mat-icon> New
</button>
</div>
<div class="column">
<mat-nav-list>
<div class="row">
<div>
<mat-card class="example-card"><a mat-list-item routerLink="workspace/{{ws.guid}}" *ngFor="let ws of workspaces" >
<mat-icon matListIcon color
matTooltip="{{ws.type == WorkspaceType.user ? 'User Workspace' : 'Group Workspace'}}">
</mat-icon>
<span matLine>Stack One</span>
<span matLine class="hint"></span>
</a>
</mat-card>
</div>
</div>
</mat-nav-list>
</div>
<mat-divider [vertical]="true" class="divider"></mat-divider>
<div style="position: absolute;font-size: 1.2em; right: 630px;top: 80px; color: white;"> Recently Edited Charts</div>
<div class="column2">
<mat-nav-list>
<div class="row">
<div>
</div>
</div>
</mat-nav-list>
</div>
答案 0 :(得分:1)
您只需要向卡中添加边距底CSS属性,如下所示:
<?import java.util.ArrayList?>
<ArrayList />
编辑:
我仔细查看了您的代码,发现您没有在创建卡片,而是在卡片内部创建列表项。您的.mat-card:not(:last-child) {
margin-bottom: 20px;
}
指令位于ngFor
标记上。将a
指令放在卡上,或者如果要创建列表项,请添加以下代码:
ngFor