{"id":1029,"date":"2017-06-28T15:31:45","date_gmt":"2017-06-28T15:31:45","guid":{"rendered":"http:\/\/wordpress.library.illinois.edu\/wp-training\/?page_id=1029"},"modified":"2017-07-31T19:27:20","modified_gmt":"2017-07-31T19:27:20","slug":"creating-tables","status":"publish","type":"page","link":"https:\/\/wordpress.library.illinois.edu\/wp-training\/creating-tables\/","title":{"rendered":"Creating Tables"},"content":{"rendered":"<h2>Making Tables Readable &amp; Accessible<\/h2>\n<table class=\"table table-striped table-bordered\">\n<thead class=\"thead-inverse\">\n<tr>\n<th><strong>Column Header 1<\/strong><\/th>\n<th><strong>Column Header 2<\/strong><\/th>\n<th><strong>Column Header 3<\/strong><\/th>\n<th><strong>Column Header 4<\/strong><\/th>\n<\/tr>\n<\/thead>\n<tbody>\n<tr>\n<td>Column 1 Table Data<\/td>\n<td>Column 2 More Table Data<\/td>\n<td>Column 3 More Table Data<\/td>\n<td>Column 4 More Table Data<\/td>\n<\/tr>\n<tr>\n<td>Column 1 Table Data<\/td>\n<td>Column 2 Table Data<\/td>\n<td>Column 3 More Table Data<\/td>\n<td>Column 4 Table Data<\/td>\n<\/tr>\n<tr>\n<td>Column 1 Table Data<\/td>\n<td>Column 2 Table Data<\/td>\n<td>Column 3 More Table Data<\/td>\n<td>Column 4 Table Data<\/td>\n<\/tr>\n<\/tbody>\n<\/table>\n<h2>About Table Tags<\/h2>\n<p>To make readable, accessible tables like this example, we first need to understand a little about table tags and what they mean.<\/p>\n<ul>\n<li><strong>&lt;table&gt;<\/strong>\u00a0General table tag. This is the main tag that wraps an entire table and all it&#8217;s elements. Be sure to have a <strong>&lt;\/table&gt; tag at the end!<\/strong><\/li>\n<li><strong>&lt;tbody&gt;<\/strong>\u00a0Table body. This should be one singular tag near the beginning of the table after the headers, and a<strong>\u00a0&lt;\/tbody&gt;<\/strong>\u00a0at the end, after all the rows.<\/li>\n<li><strong>&lt;tr&gt;<\/strong> This stands for Table Row. This tag is used to create a new row inside a table. The end of the row is noted with <strong>&lt;\/tr&gt;<\/strong><\/li>\n<li><strong>&lt;td&gt;<\/strong> This stands for table data. This is used to denote content that will appear inside of a cell column. Use this to move to the next column of data within a row. Similar to rows, they are ended with a <strong>&lt;\/td&gt;. <\/strong>Think of this as moving to the next horizontal cell in a row.<\/li>\n<li><strong>&lt;thead&gt;<\/strong> Table Header. In the example above, &#8220;Column Header 1&#8221; &#8220;Column Header 2&#8221; &#8220;Column Header 3&#8221; and &#8220;Column Header 4&#8221; are all table headers. This tag is used to set apart column titles from actual table data. Headers are particularly important for accessibility purposes, so screen readers can properly read the column titles. These cells are ended with a <strong>&lt;\/thead&gt;. <\/strong>There will be one group of these listed together at the top of the table.<\/li>\n<li><strong>&lt;tbody&gt;<\/strong> Table body. This should be one singular tag near the beginning of the table after the headers, and a<strong> &lt;\/tbody&gt;<\/strong> at the end, after all the rows.<\/li>\n<\/ul>\n<h3>The elements of the table are broken down like this:<\/h3>\n<p><img loading=\"lazy\" decoding=\"async\" class=\"aligncenter size-full wp-image-1080\" src=\"http:\/\/wordpress.library.illinois.edu\/wp-training\/wp-content\/uploads\/sites\/23\/2017\/06\/TableTutorial.png\" alt=\"Diagram showing different elements in a table.\" width=\"707\" height=\"591\" srcset=\"https:\/\/wordpress.library.illinois.edu\/wp-training\/wp-content\/uploads\/sites\/23\/2017\/06\/TableTutorial.png 707w, https:\/\/wordpress.library.illinois.edu\/wp-training\/wp-content\/uploads\/sites\/23\/2017\/06\/TableTutorial-300x251.png 300w\" sizes=\"auto, (max-width: 707px) 100vw, 707px\" \/><\/p>\n<h3>The code (in the text tab of the editor) for the table above will look like this:<\/h3>\n<p><div class=\"shortcode sh-p-4 sh-rounded sh-drop-shadow-sm sh-bg-white !sh-text-black !sh-border  \"><div><div class=\"\"><br \/>\n&lt;table class=&#8221;table table-striped table-bordered&#8221;&gt;<br \/>\n&lt;thead class=&#8221;thead-inverse&#8221;&gt;<strong><br \/>\n<\/strong>&lt;tr&gt;<br \/>\n&lt;th&gt;&lt;strong&gt;Column Header 1&lt;\/strong&gt;&lt;\/th&gt;<br \/>\n&lt;th&gt;&lt;strong&gt;Column Header 2&lt;\/strong&gt;&lt;\/th&gt;<br \/>\n&lt;th&gt;&lt;strong&gt;Column Header 3&lt;\/strong&gt;&lt;\/th&gt;<br \/>\n&lt;th&gt;&lt;strong&gt;Column Header 4&lt;\/strong&gt;&lt;\/th&gt;<br \/>\n&lt;\/tr&gt;<br \/>\n&lt;\/thead&gt;<br \/>\n&lt;tbody&gt;<br \/>\n&lt;tr&gt;<br \/>\n&lt;td&gt;Column 1 Table Data&lt;\/td&gt;<br \/>\n&lt;td&gt;Column 2 More Table Data&lt;\/td&gt;<br \/>\n&lt;td&gt;Column 3 More Table Data&lt;\/td&gt;<br \/>\n&lt;td&gt;Column 4 More Table Data&lt;\/td&gt;<br \/>\n&lt;\/tr&gt;<br \/>\n&lt;tr&gt;<br \/>\n&lt;td&gt;Column 1 Table Data&lt;\/td&gt;<br \/>\n&lt;td&gt;Column 2 Table Data&lt;\/td&gt;<br \/>\n&lt;td&gt;Column 3 More Table Data&lt;\/td&gt;<br \/>\n&lt;td&gt;Column 4 Table Data&lt;\/td&gt;<br \/>\n&lt;\/tr&gt;<br \/>\n&lt;tr&gt;<br \/>\n&lt;td&gt;Column 1 Table Data&lt;\/td&gt;<br \/>\n&lt;td&gt;Column 2 Table Data&lt;\/td&gt;<br \/>\n&lt;td&gt;Column 3 More Table Data&lt;\/td&gt;<br \/>\n&lt;td&gt;Column 4 Table Data&lt;\/td&gt;<br \/>\n&lt;\/tr&gt;<br \/>\n&lt;\/tbody&gt;<br \/>\n&lt;\/table&gt;<br \/>\n<\/div><\/div><\/div><\/p>\n<h2>Adding Columns<\/h2>\n<p>To add a column, add a new table header inside the &lt;thead&gt; tag, like this:<br \/>\n<div class=\"shortcode sh-p-4 sh-rounded sh-drop-shadow-sm sh-bg-white !sh-text-black !sh-border  \"><div><div class=\"\"><\/p>\n<p>&lt;thead class=&#8221;thead-inverse&#8221;&gt;<br \/>\n&lt;tr&gt;<br \/>\n&lt;th&gt;&lt;strong&gt;Column Header 1&lt;\/strong&gt;&lt;\/th&gt;<br \/>\n&lt;th&gt;&lt;strong&gt;Column Header 2&lt;\/strong&gt;&lt;\/th&gt;<br \/>\n&lt;th&gt;&lt;strong&gt;Column Header 3&lt;\/strong&gt;&lt;\/th&gt;<br \/>\n&lt;th&gt;&lt;strong&gt;Column Header 4&lt;\/strong&gt;&lt;\/th&gt;<br \/>\n<strong>&lt;th&gt;&lt;strong&gt;NEW COLUMN&lt;\/strong&gt;&lt;\/th&gt;<\/strong><br \/>\n&lt;\/tr&gt;<br \/>\n&lt;\/thead&gt;<\/p>\n<\/div><\/div><\/div>\n<h2>Adding Rows<\/h2>\n<p>To add a new row, simply add a new &lt;tr&gt; tag and fill it with the row&#8217;s contents, like this:<\/p>\n<div class=\"shortcode sh-col-span-6 sh-pb-3\"><br \/>\nCode<\/p>\n<hr \/>\n<p>&lt;tr&gt;<br \/>\n&lt;td&gt;Table Data&lt;\/td&gt;<br \/>\n&lt;td&gt;Table Data&lt;\/td&gt;<br \/>\n&lt;td&gt;More Table Data&lt;\/td&gt;<br \/>\n&lt;td&gt;Table Data&lt;\/td&gt;<br \/>\n&lt;\/tr&gt;<\/p>\n<\/div>\n<div class=\"shortcode sh-col-span-6 sh-pb-3\"><br \/>\nAction<\/p>\n<hr \/>\n<p><strong>Start a new row<br \/>\nTable data for column 1<\/strong><br \/>\n<strong>Table data for column 2<\/strong><br \/>\n<strong>Table data for column 3<\/strong><br \/>\n<strong>Table data for column 4<br \/>\nEnd Row<\/strong><\/p>\n<\/div>\n<p>&nbsp;<\/p>\n","protected":false},"excerpt":{"rendered":"<p>Making Tables Readable &amp; Accessible Column Header 1 Column Header 2 Column Header 3 Column Header 4 Column 1 Table Data Column 2 More Table Data Column 3 More Table Data Column 4 More Table Data Column 1 Table Data Column 2 Table Data Column 3 More Table Data Column 4 Table Data Column 1 [&hellip;]<\/p>\n","protected":false},"author":73,"featured_media":0,"parent":0,"menu_order":0,"comment_status":"closed","ping_status":"closed","template":"","meta":{"_acf_changed":false,"footnotes":""},"class_list":["post-1029","page","type-page","status-publish","hentry"],"acf":[],"_links":{"self":[{"href":"https:\/\/wordpress.library.illinois.edu\/wp-training\/wp-json\/wp\/v2\/pages\/1029","targetHints":{"allow":["GET"]}}],"collection":[{"href":"https:\/\/wordpress.library.illinois.edu\/wp-training\/wp-json\/wp\/v2\/pages"}],"about":[{"href":"https:\/\/wordpress.library.illinois.edu\/wp-training\/wp-json\/wp\/v2\/types\/page"}],"author":[{"embeddable":true,"href":"https:\/\/wordpress.library.illinois.edu\/wp-training\/wp-json\/wp\/v2\/users\/73"}],"replies":[{"embeddable":true,"href":"https:\/\/wordpress.library.illinois.edu\/wp-training\/wp-json\/wp\/v2\/comments?post=1029"}],"version-history":[{"count":10,"href":"https:\/\/wordpress.library.illinois.edu\/wp-training\/wp-json\/wp\/v2\/pages\/1029\/revisions"}],"predecessor-version":[{"id":1178,"href":"https:\/\/wordpress.library.illinois.edu\/wp-training\/wp-json\/wp\/v2\/pages\/1029\/revisions\/1178"}],"wp:attachment":[{"href":"https:\/\/wordpress.library.illinois.edu\/wp-training\/wp-json\/wp\/v2\/media?parent=1029"}],"curies":[{"name":"wp","href":"https:\/\/api.w.org\/{rel}","templated":true}]}}