Skip to main content

angular material - How to change Divider margin

app.component.ts

import { Component } from '@angular/core';

@Component({
  selector: 'app-root',
  templateUrl: './app.component.html',
  styles: [`
      .mat-divider {
        margin-top: 20px;
        margin-bottom: 20px
      }
  `]
})


export class AppComponent { }
app.component.html

<h2 style="padding-top:25px; padding-bottom:25px;">
    Angular Material - How to change Divider margin
</h2>


<h4 style="margin-bottom:25px;">
    Divider marign : top and bottom 20 pixels
</h4>

<button mat-raised-button color="primary">
    First Button
</button>
<mat-divider></mat-divider>

<button mat-raised-button  color="primary">
    Second Button
</button>
<mat-divider></mat-divider>

<button mat-raised-button  color="primary">
    Third Button
</button>
app.module.ts [import]

import {MatDividerModule} from '@angular/material/divider'
import {MatButtonModule} from '@angular/material/button'
More Angular tutorials