最新消息:雨落星辰是一个专注网站SEO优化、网站SEO诊断、搜索引擎研究、网络营销推广、网站策划运营及站长类的自媒体原创博客

javascript - Add paddings between closed angular material accordion panels with css or html - Stack Overflow

programmeradmin7浏览0评论

I'm curious how to add padding/margin (spaces) between the panels. Looking for html/css solution.

any ideas?

accordion-payment-panel {
margin-bottom: 10px!important; // won't work
}

I'm curious how to add padding/margin (spaces) between the panels. Looking for html/css solution.

https://material.angular.io/ponents/expansion/examples

any ideas?

accordion-payment-panel {
margin-bottom: 10px!important; // won't work
}
Share Improve this question asked Jun 3, 2020 at 12:24 HaradzieniecHaradzieniec 9,33833 gold badges122 silver badges227 bronze badges
Add a ment  | 

3 Answers 3

Reset to default 12

try add this code in css:

.mat-accordion .mat-expansion-panel{
  margin-bottom: 10px;
}

I believe this solves your problem:

.mat-accordion .mat-expansion-panel:not(.mat-expanded),
.mat-accordion .mat-expansion-panel:not(.mat-expansion-panel-spacing) {
   margin-bottom: 20px;
}

link to code in github

This is the example the material-angular site created and it produces the spacing correctly:

 <mat-accordion class="example-headers-align">
     .....
 </mat-accordion>

and then for the .css:

.example-headers-align .mat-expansion-panel-header-title,
.example-headers-align .mat-expansion-panel-header-description {
  flex-basis: 0;
}

.example-headers-align .mat-expansion-panel-header-description {
  justify-content: space-between;
  align-items: center;
}

.example-headers-align .mat-form-field + .mat-form-field {
  margin-left: 8px;
}
发布评论

评论列表(0)

  1. 暂无评论