{"id":684,"date":"2020-01-02T19:51:27","date_gmt":"2020-01-03T00:51:27","guid":{"rendered":"http:\/\/newmediaproduction.mynmi.net\/?page_id=684"},"modified":"2022-07-11T21:40:46","modified_gmt":"2022-07-11T21:40:46","slug":"html-tables","status":"publish","type":"page","link":"https:\/\/nmi.cool\/web\/html-tables\/","title":{"rendered":"HTML Tables"},"content":{"rendered":"\n<figure class=\"wp-block-image size-large\"><img decoding=\"async\" src=\"https:\/\/nmi.cool\/newmediaproduction\/wp-content\/uploads\/sites\/3\/2022\/01\/kitchen-table.jpeg\" alt=\"\"\/><figcaption>Photo by&nbsp;<a href=\"https:\/\/unsplash.com\/@barrowmanphotography\">Andrew Barrowman<\/a>.<\/figcaption><\/figure>\n\n\n\n<p>Building tables by hand? Pretty difficult. Creating tables with HTML? Easy peasy. <\/p>\n\n\n\n<p>First, create a new HTML file called tables.html and save it in your webdev folder. Within the &lt;body> of that file, start your table with the\u2014you guessed it\u2014<strong>&lt;table><\/strong> tag. Chances are, Visual Studio Code will finish writing the table tag (<strong>&lt;\/table<\/strong>) for you. <\/p>\n\n\n\n<p>Between your table tags, it\u2019s time to add rows, denoted by <strong>&lt;tr&gt;<\/strong> (table rows). Each cell in the table is written using a <strong>&lt;td&gt;<\/strong> (table data) tag.&nbsp;&nbsp;<\/p>\n\n\n\n<p>Type the following into your file:<\/p>\n\n\n\n<pre class=\"wp-block-preformatted\"> &nbsp;&nbsp;&nbsp;&lt;table&gt;\n &nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&lt;tr&gt;\n &nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&lt;td&gt;A&lt;\/td&gt;\n &nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&lt;td&gt;B&lt;\/td&gt;\n &nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&lt;td&gt;C&lt;\/td&gt;\n &nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&lt;td&gt;D&lt;\/td&gt;\n &nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&lt;\/tr&gt;\n &nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&lt;tr&gt;\n &nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&lt;td&gt;A2&lt;\/td&gt;\n &nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&lt;td&gt;B2&lt;\/td&gt;\n &nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&lt;td&gt;C3&lt;\/td&gt;\n &nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&lt;td&gt;D4&lt;\/td&gt;\n &nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&lt;\/tr&gt;\n &nbsp;&nbsp;&nbsp;&lt;\/table&gt; <\/pre>\n\n\n\n<p>Preview your file by saving it and opening it in Chrome.  <\/p>\n\n\n\n<h2 class=\"wp-block-heading\">Table heading<\/h2>\n\n\n\n<p>Wouldn\u2019t this table look better with a table heading? The <strong>&lt;th&gt;<\/strong> element stands for table heading. The <strong>&lt;th&gt;<\/strong> element is <strong>incredibly important, <\/strong>for a variety of reasons. It can be used to represent an empty cell (notice the first cell in the example). It also helps makes your tables more accessible\u2014both a legal and ethical requirement of websites. <\/p>\n\n\n\n<p>Often, you see the table heading (<strong>&lt;th<\/strong>&gt;) tag used with <strong>scope<\/strong>. Scope specifies whether the heading is for a column or row. See the following example of scope in use: <\/p>\n\n\n\n<pre class=\"wp-block-preformatted\"> &lt;table&gt;\n &nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&lt;tr&gt;\n &nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&lt;th&gt;&lt;\/th&gt;\n &nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&lt;th scope=\"col\"&gt;FCC Lessons Completed&lt;\/th&gt;\n &nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&lt;\/tr&gt;\n &nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&lt;tr&gt;\n &nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&lt;th scope=\"col\"&gt;Week 1:&lt;\/th&gt;\n &nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&lt;td&gt;14&lt;\/td&gt;\n &nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&lt;\/tr&gt;\n &nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&lt;th scope=\"col\"&gt;Week 2:&lt;\/th&gt;\n &nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&lt;td&gt;14&lt;\/td&gt;\n &nbsp;&nbsp;&nbsp;&lt;\/table&gt; <\/pre>\n\n\n\n<p>Try it out!<\/p>\n\n\n\n<p><strong>Your turn! <br><\/strong><br>A) Try to add Week 3, Week 4, and Week 5 to the table, keeping the same formatting.&nbsp;<br>B) Practice creating your own HTML table. Your table can display any information you\u2019d like\u2014fictional or real. Get creative and gain some familiarity making a HTML table on your own. <\/p>\n\n\n\n<p>When you&#8217;re done, save your file and open it in Chrome to check it out. No need to upload it to the server unless you want the practice! <\/p>\n","protected":false},"excerpt":{"rendered":"<p>Building tables by hand? Pretty difficult. Creating tables with HTML? Easy peasy. First, create a new HTML file called tables.html and save it in your webdev folder. Within the &lt;body> of that file, start your table with the\u2014you guessed it\u2014&lt;table> tag. Chances are, Visual Studio Code will finish writing the table tag (&lt;\/table) for you. &hellip; <a href=\"https:\/\/nmi.cool\/web\/html-tables\/\" class=\"more-link\">Continue reading <span class=\"screen-reader-text\">HTML Tables<\/span><\/a><\/p>\n","protected":false},"author":1,"featured_media":0,"parent":0,"menu_order":0,"comment_status":"closed","ping_status":"closed","template":"","meta":{"footnotes":""},"class_list":["post-684","page","type-page","status-publish","hentry"],"_links":{"self":[{"href":"https:\/\/nmi.cool\/web\/wp-json\/wp\/v2\/pages\/684","targetHints":{"allow":["GET"]}}],"collection":[{"href":"https:\/\/nmi.cool\/web\/wp-json\/wp\/v2\/pages"}],"about":[{"href":"https:\/\/nmi.cool\/web\/wp-json\/wp\/v2\/types\/page"}],"author":[{"embeddable":true,"href":"https:\/\/nmi.cool\/web\/wp-json\/wp\/v2\/users\/1"}],"replies":[{"embeddable":true,"href":"https:\/\/nmi.cool\/web\/wp-json\/wp\/v2\/comments?post=684"}],"version-history":[{"count":2,"href":"https:\/\/nmi.cool\/web\/wp-json\/wp\/v2\/pages\/684\/revisions"}],"predecessor-version":[{"id":3730,"href":"https:\/\/nmi.cool\/web\/wp-json\/wp\/v2\/pages\/684\/revisions\/3730"}],"wp:attachment":[{"href":"https:\/\/nmi.cool\/web\/wp-json\/wp\/v2\/media?parent=684"}],"curies":[{"name":"wp","href":"https:\/\/api.w.org\/{rel}","templated":true}]}}