Search code examples
htmlcssangularstylesmat

Align text in mat-button-toggle


I make a mat-button-toggle-group but it has a button child that preserves its old dimension. How can I have access to it?

I tried to write this code but it doesn't work.

mat-button-toggle {
    border: 1px solid #0ea399;
    border-radius: 4px;
    margin-left: 3px;
    margin-right:3px;
    width: 30px;
    height: 30px;
    font-family: 'Nunito Semibold', sans-serif;
    font-size: 14px;
    font-style: bold;
}

.mat-button-toggle-disabled {
    border: 1px solid #c5c0c7;
    background-color: #e1dde5;
}

.center > span {
    line-height: 0px !important;
    text-align: center;
}

Solution

  • Can you try using deep selector to access its closed dom content.

    mat-button-toggle ::ng-deep span{ 
       color:green;
       display:inline-block;
       line-height:0px;
    }