Question about HTML/CSS Coding

I have a website that uses a lot of tables. Most, but not all, need borders on the table and table cells for readability. I have been using the following code to do this:

The border=1 element places both external and internal borders in the table, but is obsolete for HTML 5 and should not be used. I can use CSS codes to place borders, but must use separate codes for the table and the individual TD elements.

How can I code for internal cell borders in a simple to code way that does not require adding style codes to every TD element, or putting them in my .CSS file, which would place borders on all TD elements, even those I don’t want bordered? Bonus if the fix is easily applicable to the around 100 web pages using tables.

Give a class to the table, so that you can write a CSS rule that only applies to child TDs of that class:

<table class=“myclass”> etc

.myclass TD {border: 1px solid black;}

You’ll probably also want to collapse borders

.myclass {border-collapse: collapse;}

Thanks. I’ll try this suggestion.