CSS code for table borders

What is css code to change all table borders to black?

@Marvin this should do the trick for table cells and headers:

.kn-table td, .kn-table th {
  border: 1px solid #000 !important;
}

If you don’t include !important, it will not overwrite any existing styling.

Example below:
image

Hi @StephenChapman

You don’t necessarily need !important. In fact I would advise against it. The reason is that if you want to change the colour for different tables you won’t be able to do this easily. Using important should be a last resort.

I would suggest for styles that you make the selector more specific than Knack do i.e.

#knack-body .kn-table td, #knack-body .kn-table th{
    border: 1px solid black;
}

This is just an example but there are other selectors you could use to make your style more specific.

Craig

2 Likes