Page 1 of 1

[SOLVED] HTML 5 and Tables - Ugh!!!!!!!!!!!!

Posted: Tue Jun 08, 2021 10:51 pm
by paulp575
Trying to update my personal web pages to HTML 5 and getting errors with a table that needs to have a border.

Not sure what's going on, but the specific problem is on the military.htm page - the table is "Unit Assignments" table.
I need to have lines in the table and want a cellpadding of 5 and a cellspacing of 0.

Help!!!!!!!!

Re: HTML 5 and Tables - Ugh!!!!!!!!!!!!

Posted: Wed Jun 09, 2021 12:33 am
by Albert Wiersch
Hi Paul,

I took a look at the table you mentioned. Try changing this:

Code: Select all

<table cellpadding="5" cellspacing="0" border="1" class="TABLE-CENTERED">
to this:

Code: Select all

<table id="unitassignments" class="TABLE-CENTERED">
Then adding this CSS to the page's styles:

Code: Select all

table#unitassignments { border-collapse: collapse; }
table#unitassignments td { padding: .3em; border: 2px solid black; }
It should give the table a similar look to using the obsolete "border", "cellpadding", and "cellspacing" HTML attributes.

Re: HTML 5 and Tables - Ugh!!!!!!!!!!!!

Posted: Wed Jun 09, 2021 11:05 am
by paulp575
Thanks.

Appreciate the corrections.