Admin Forum:Need help converting data table to HTML 5

Top
Please see:
 * http://cannabis.wikia.com/wiki/User:Timeshifter/Sandbox_19

See the middle table. I need an HTML-5 way to add cell padding to all the cells but without adding it individually to each cell. I also need narrower borders. See the bottom cell to see what I am looking for.

I want to be able to paste the finished table into email, and so I don't want the table dependent on external CSS style sheets.

It seems also that style="text-align:left;" in the division works on all cells in Firefox, but not in Internet Explorer. --Timeshifter 20:02, July 10, 2012 (UTC)


 * I'm looking into it for you now. – Jazzi  ( talk ) 20:10, July 10, 2012 (UTC)


 * Done. Copy the following onto the page:

– Jazzi  ( talk ) 20:13, July 10, 2012 (UTC)


 * To answer your note about Internet Explorer, if you apply text-align to the table, IE does not apply that to every cell. You have to apply it to every cell yourself because IE is a bit retarded >_>. You could do that by giving your table a class, say class="my-table" and then putting this in your MediaWiki:Common.css:


 * Your above table is not HTML-5 compliant. "bgcolor" and "align" for example. Thanks for trying though. I am not sure it is possible to do what I want to do.


 * I think the designers of HTML 5 and browsers are clueless to real world needs in many cases. Especially for pasting stuff into email where one can't take an external stylesheet. And especially for making tables simpler. It should be possible to set the text alignment of all header cells in a division, or all data cells. But I am getting the feeling that it is not possible. See:
 * http://www.webdeveloper.com/forum/showthread.php?t=262443


 * I guess I will have add some HTML-4 stuff as backup:
 * border=1 cellspacing=0 cellpadding=3


 * It solves the problem. I hope it is left in the wikitext after the latest Mediawiki version is installed on my wiki. That way the table will still look right when pasted in email.


 * Maybe by HTML 6 the designers of it will get a clue. --Timeshifter 20:53, July 10, 2012 (UTC)
 * Wiki needs != real world needs.--PedroM 21:11, July 10, 2012 (UTC)


 * Why paste stuff into emails? That's what attachments are for. Pasting stuff into emails is laziness.


 * Fools open attachments. :) --Timeshifter 21:36, July 10, 2012 (UTC)

Found CSS for narrow cell borders
Return to top.

This page is very helpful:
 * http://www.quirksmode.org/css/tables.html

border=1 style="border-collapse:collapse;"

creates narrow cell borders, and it is HTML-5 compliant. See:
 * http://cannabis.wikia.com/wiki/User:Timeshifter/Sandbox_19 --Timeshifter 23:43, July 10, 2012 (UTC)

Ways to add padding to all cells
Return to top.

Still looking for an HTML-5 way to add padding to all the table cells at once. --Timeshifter 23:43, July 10, 2012 (UTC)


 * So far as I know, there is no HTML-5 way to add padding to all table cells. The purpose of HTML is structure, not style. For style, you're supposed to use CSS, because that's why CSS exists. (I posted one CSS way of doing cellpadding above, by the way).


 * Thanks, but I want do it without an external stylesheet. In HTML 4 it is easy. Just add cellpadding=4 to the top of the table code. But in HTML 5 it seems one has to add CSS to every single cell. There is no single CSS style (as far as I know) one can place at the top of the table code, or division code, to add padding to all cells in the table. --Timeshifter 23:57, July 10, 2012 (UTC)


 * You're correct, Timeshifter. It cannot be done without an extrenal stylesheet. It would not have to be a complicated one though: