Help with CSS for ePub3/HTML5 Tables?
I'm reformatting an old book in ePub3/HTML5. It has 6 tables that are defined with HTML using cellpadding and cellspacing (which are deprecated in HTML5). I'd like to get that into some CSS styles. Four of the 6 tables use:
- cellpadding="1" and
- cellspacing="0".
So, I guess those would be the default styles. One table uses:
- cellpadding="4" and
- cellspacing="0"
and the last table uses:
- cellpadding="5" and
- cellspacing="5"
I'm brand new to tables in css/html. But, I think for the "default" cellpadding="1", cellspacing="0" style, I'll need to set:
table {
border-spacing: 0px;
}
table,
td,
th {
border-collapse: separate;
}
td,
th {
padding: 1px;
}
For the cellpadding="4", cellspacing="0" style, I think I'd need a style for setting td and th padding: 4px
and for cellpadding="5", cellspacing="5" style, I'd need styles changing table border-spacing=5px and td, th padding:5px.
Does that sound reasonable?
And for my more basic question, how do I set up CSS classes/styles to handle the different versions? If I just needed to change the defaults, I could just list those things as above. But, how do I get them into multiple, separate, non-default classes/styles?
|