João Silva
João Silva

Reputation: 581

Angular material checkbox vertical line

I'm having an issue with Angular Material checkbox where after rendering there is an additional vertical line that is added because a class in the material.

This is my HTML:

<div class="col-md-6 col-sm-12">
   <div class="col-sm-12">
      <mat-checkbox class="full-width" formControlName="TPA_NUSC">{{ 'GLOBAL.TAX_NUMBER_MANDATORY_AB' | translate}}</mat-checkbox>
   </div>
   <div class="col-sm-12">
      <mat-checkbox class="full-width" formControlName="TPA_VLNC">{{ 'GLOBAL.VALIDATE_TAX_NUMBER_AB' | translate}}</mat-checkbox>
   </div>
</div>

And this is my output:

enter image description here

That verical line comes from the class "mat-checkbox" that is added after the rendering, at least, if I remove the class the line will disappear.

Any tips about this issue?

Upvotes: 0

Views: 499

Answers (2)

Jo&#227;o Silva
Jo&#227;o Silva

Reputation: 581

I have found the issue, seems that someone add a class in our company css that override that indigo-pink.css

Many thanks to @Peter Kim to allow me to find the issue.

If anyone will have an issue like this, there is how I found out what could be wrong.

  1. Try to get the cloested element in your developer console

enter image description here

Doing that I found out that the class had an border-right.

  1. Click in the right top corner to go to the css file that is causing the issue

enter image description here

  1. It will redirrect you to the css file, however it may not tell you which file it's, but you can go to your index.ts or where you declared your css and count the css until you get a match, for example, in my case it was the 14th sheet.

enter image description here

  1. Just go to that sheet and search for the issue, in my case I searched for #b7b7b7 and it was a direct match.

enter image description here

Hope it help some else.

Upvotes: 0

Peter Kim
Peter Kim

Reputation: 1977

I had a similar problem but realized that I didn't have a theme.

Make sure you have something like this in styles.css: @import "~@angular/material/prebuilt-themes/indigo-pink.css";

Upvotes: 1

Related Questions