  {"id":21070,"date":"2025-02-03T12:00:33","date_gmt":"2025-02-03T17:00:33","guid":{"rendered":"https:\/\/carleton.ca\/webaccessibility\/?page_id=21070"},"modified":"2025-06-09T08:21:08","modified_gmt":"2025-06-09T12:21:08","slug":"use-of-tables","status":"publish","type":"page","link":"https:\/\/carleton.ca\/webaccessibility\/use-of-tables\/","title":{"rendered":"Proper use of tables"},"content":{"rendered":"\n<section class=\"w-screen px-6 cu-section cu-section--white ml-offset-center md:px-8 lg:px-14\">\n    <div class=\"space-y-6 cu-max-w-child-5xl  md:space-y-10 cu-prose-first-last\">\n\n            <div class=\"cu-textmedia flex flex-col lg:flex-row mx-auto gap-6 md:gap-10 my-6 md:my-12 first:mt-0 max-w-5xl\">\n        <div class=\"justify-start cu-textmedia-content cu-prose-first-last\" style=\"flex: 0 0 100%;\">\n            <header class=\"font-light prose-xl cu-pageheader md:prose-2xl cu-component-updated cu-prose-first-last\">\n                                    <h1 class=\"cu-prose-first-last font-semibold !mt-2 mb-4 md:mb-6 relative after:absolute after:h-px after:bottom-0 after:bg-cu-red after:left-px text-3xl md:text-4xl lg:text-5xl lg:leading-[3.5rem] pb-5 after:w-10 text-cu-black-700 not-prose\">\n                        Proper use of tables\n                    <\/h1>\n                \n                                \n                            <\/header>\n\n                    <\/div>\n\n            <\/div>\n\n    <\/div>\n<\/section>\n\n\n\n<h2 id=\"accessibility\" class=\"wp-block-heading\">Accessibility<\/h2>\n\n\n\n<p>Tables can be used to display the kind of information that is appropriate, and that kind of data only. It has to be created in a specific manner to optimize its accessibility.<\/p>\n\n\n\n<h2 id=\"reason\" class=\"wp-block-heading\">Reason<\/h2>\n\n\n\n<p>Tables can be a difficult feature to navigate on a web page, especially if it does not contain a table header row, or if it is used to lay out content instead of its actual purpose. <\/p>\n\n\n\n<h2 id=\"best-practice\" class=\"wp-block-heading\">Best practice<\/h2>\n\n\n\n<p>Here is an example of a properly constructed table with a header row, containing data appropriate to a table. <\/p>\n\n\n\n<figure class=\"wp-block-table\"><table class=\"has-fixed-layout\"><thead><tr><th class=\"has-text-align-left\" data-align=\"left\">Course<\/th><th class=\"has-text-align-left\" data-align=\"left\">Department<\/th><\/tr><\/thead><tbody><tr><td class=\"has-text-align-left\" data-align=\"left\">Math 1001<\/td><td class=\"has-text-align-left\" data-align=\"left\">Math and Statistics<\/td><\/tr><tr><td class=\"has-text-align-left\" data-align=\"left\">Statistics 1002<\/td><td class=\"has-text-align-left\" data-align=\"left\">Math and Statistics<\/td><\/tr><tr><td class=\"has-text-align-left\" data-align=\"left\">Environmental Studies 2002<\/td><td class=\"has-text-align-left\" data-align=\"left\">Geography and Environmental Studies<\/td><\/tr><tr><td class=\"has-text-align-left\" data-align=\"left\">History of Math 4004<\/td><td class=\"has-text-align-left\" data-align=\"left\">History<\/td><\/tr><\/tbody><\/table><\/figure>\n\n\n\n<h2 id=\"example-of-less-accessible-practices\" class=\"wp-block-heading\">Example of less accessible practices<\/h2>\n\n\n\n<p>Here are some examples of a bad table.<\/p>\n\n\n\n<p>In this example, we find a table which has no header. It gives no context to someone using a screen reader:<\/p>\n\n\n\n<figure class=\"wp-block-image size-large is-resized\"><img loading=\"lazy\" decoding=\"async\" width=\"1024\" height=\"396\" src=\"https:\/\/carleton.ca\/webaccessibility\/wp-content\/uploads\/sites\/96\/2025\/02\/Screenshot-2025-02-03-at-11.23.29-1024x396.png\" alt=\"A table constructed with no table header does not allow the screen reader to deliver the information in an organized manner. \" class=\"wp-image-21074\" style=\"width:710px;height:auto\" srcset=\"https:\/\/carleton.ca\/webaccessibility\/wp-content\/uploads\/sites\/96\/2025\/02\/Screenshot-2025-02-03-at-11.23.29-1024x396.png 1024w, https:\/\/carleton.ca\/webaccessibility\/wp-content\/uploads\/sites\/96\/2025\/02\/Screenshot-2025-02-03-at-11.23.29-512x198.png 512w, https:\/\/carleton.ca\/webaccessibility\/wp-content\/uploads\/sites\/96\/2025\/02\/Screenshot-2025-02-03-at-11.23.29-320x124.png 320w, https:\/\/carleton.ca\/webaccessibility\/wp-content\/uploads\/sites\/96\/2025\/02\/Screenshot-2025-02-03-at-11.23.29-768x297.png 768w, https:\/\/carleton.ca\/webaccessibility\/wp-content\/uploads\/sites\/96\/2025\/02\/Screenshot-2025-02-03-at-11.23.29-1536x594.png 1536w, https:\/\/carleton.ca\/webaccessibility\/wp-content\/uploads\/sites\/96\/2025\/02\/Screenshot-2025-02-03-at-11.23.29.png 1542w\" sizes=\"auto, (max-width: 1024px) 100vw, 1024px\" \/><\/figure>\n\n\n\n<p>(You will notice that this is an image of a table &#8211; that is because the table function in cuTheme does not allow for a table to be created <em class=\"myprefix-text-italic\">without<\/em> a table header row. Alt text on the image describes the problem with this table.)<\/p>\n\n\n\n<p>This table would not allow easy access to the tabular information.<\/p>\n\n\n\n<p>The second table (also an image) shows a table being used to layout page content using a table:<\/p>\n\n\n\n<figure class=\"wp-block-image size-large is-resized\"><img loading=\"lazy\" decoding=\"async\" width=\"1024\" height=\"744\" src=\"https:\/\/carleton.ca\/webaccessibility\/wp-content\/uploads\/sites\/96\/2025\/02\/Screenshot-2025-02-03-at-11.36.12-1024x744.png\" alt=\"A table with ordinary page contents looks less pleasing and may be skipped by users with screen readers. \" class=\"wp-image-21075\" style=\"width:490px;height:auto\" srcset=\"https:\/\/carleton.ca\/webaccessibility\/wp-content\/uploads\/sites\/96\/2025\/02\/Screenshot-2025-02-03-at-11.36.12-1024x744.png 1024w, https:\/\/carleton.ca\/webaccessibility\/wp-content\/uploads\/sites\/96\/2025\/02\/Screenshot-2025-02-03-at-11.36.12-512x372.png 512w, https:\/\/carleton.ca\/webaccessibility\/wp-content\/uploads\/sites\/96\/2025\/02\/Screenshot-2025-02-03-at-11.36.12-320x232.png 320w, https:\/\/carleton.ca\/webaccessibility\/wp-content\/uploads\/sites\/96\/2025\/02\/Screenshot-2025-02-03-at-11.36.12-768x558.png 768w, https:\/\/carleton.ca\/webaccessibility\/wp-content\/uploads\/sites\/96\/2025\/02\/Screenshot-2025-02-03-at-11.36.12-1536x1116.png 1536w, https:\/\/carleton.ca\/webaccessibility\/wp-content\/uploads\/sites\/96\/2025\/02\/Screenshot-2025-02-03-at-11.36.12.png 1608w\" sizes=\"auto, (max-width: 1024px) 100vw, 1024px\" \/><\/figure>\n\n\n\n<p>Not only does this add confusion, many users will skip tables with no header row and so any useful\/crucial information will be missed. Besides why would you want to lay information out in this way when it could look like this?<\/p>\n\n\n\n<section class=\"w-screen px-6 cu-section cu-section--white ml-offset-center md:px-8 lg:px-14\">\n    <div class=\"space-y-6 cu-max-w-child-5xl  md:space-y-10 cu-prose-first-last\">\n\n                \n        <div class=\"cu-column cu-component not-contained mx-auto grid max-w-5xl md:grid-cols-3 gap-6 md:gap-10\">\n            \n\n<div class=\"not-prose cu-card rounded-lg @container md:max-w-xl flex flex-col gap-3 bg-white shadow-lg shadow-cu-black-100   \">\n            <figure class=\"mx-6 mt-6 mb-2 overflow-hidden max-w-[45%] @xl:md:max-w-[25%] rounded-md aspect-[4\/2.7]\">\n            <img loading=\"lazy\" decoding=\"async\" src=\"https:\/\/carleton.ca\/webaccessibility\/wp-content\/uploads\/sites\/96\/2025\/02\/Screenshot-2025-02-03-at-11.41.56-300x200.png\" alt=\"\" width=\"200\" height=\"133\"><\/figure>\n        \n                        <header class=\"flex flex-col gap-3  px-6 first:mt-6\">\n                \n        \n    \n    <h2 class=\"line-clamp-3 text-lg font-semibold text-cu-black @sm:md:text-xl leading-6 @sm:md:leading-8\">\n        Dio\n    <\/h2>\n\n            <\/header>\n\n        \n                    <div class=\"flex flex-col px-6\">\n                <p class=\"text-base text-cu-black-700\">\n                    Cat ipsum dolor sit amet, flee in terror at cucumber discovered on floor but cats are fats i like to pets them they like to meow back. Grab pompom in mouth \n                <\/p>\n            <\/div>\n        \n                                \n            <footer class=\"px-6 pt-3 mt-auto text-white md:pt-5\">\n                <a  href=\"https:\/\/carleton.ca\/webaccessibility\/web-accessibility-best-practices\/\" class=\"cu-button cu-button--red cu-button--small\">\n                    More info about Dio\n                <\/a>\n            <\/footer>\n            <\/div>\n    \n\n\n<div class=\"not-prose cu-card rounded-lg @container md:max-w-xl flex flex-col gap-3 bg-white shadow-lg shadow-cu-black-100   \">\n            <figure class=\"mx-6 mt-6 mb-2 overflow-hidden max-w-[45%] @xl:md:max-w-[25%] rounded-md aspect-[4\/2.7]\">\n            <img loading=\"lazy\" decoding=\"async\" src=\"https:\/\/carleton.ca\/webaccessibility\/wp-content\/uploads\/sites\/96\/2025\/02\/Screenshot-2025-02-03-at-11.47.17-300x200.png\" alt=\"\" width=\"200\" height=\"133\"><\/figure>\n        \n                        <header class=\"flex flex-col gap-3  px-6 first:mt-6\">\n                \n        \n    \n    <h2 class=\"line-clamp-3 text-lg font-semibold text-cu-black @sm:md:text-xl leading-6 @sm:md:leading-8\">\n        Ruka\n    <\/h2>\n\n            <\/header>\n\n        \n                    <div class=\"flex flex-col px-6\">\n                <p class=\"text-base text-cu-black-700\">\n                    Fluffness ahh cucumber!\u00a0cats go for world domination\u00a0scoot butt on the rug.\u00a0Scream for no reason at 4 am\u00a0kitty kitty pussy cat doll\u00a0or destroy couch.\u00a0\n                <\/p>\n            <\/div>\n        \n                                \n            <footer class=\"px-6 pt-3 mt-auto text-white md:pt-5\">\n                <a  href=\"https:\/\/carleton.ca\/webaccessibility\/web-accessibility-best-practices\/\" class=\"cu-button cu-button--red cu-button--small\">\n                    More info about Ruka\n                <\/a>\n            <\/footer>\n            <\/div>\n    \n\n        <\/div>\n\n        \n    <\/div>\n<\/section>\n\n\n\n<h2 id=\"additional-benefits\" class=\"wp-block-heading\">Additional benefits<\/h2>\n\n\n\n<ul class=\"wp-block-list\">\n<li><strong class=\"myprefix-text-bold\">Usability<\/strong>: Table headers bring additional visual cue, both drawing the user to the table, and quickly orienting them to what the data includes. <\/li>\n\n\n\n<li><strong class=\"myprefix-text-bold\">SEO<\/strong>: Making your content more organized (which tables help with) is something which search engines value, especially when the tables contain relevant data and are properly formatted with clear headers and labels. More properly formed HTML in general (which includes table headings) also helps with SEO<\/li>\n\n\n\n<li><strong class=\"myprefix-text-bold\">Marketing<\/strong>: Thanks to the improvement in usability (see above) the University becomes more appealing. Especially with items like course listings, presenting data in an easy to access format, like a proper table, helps people understand requirements and makes their ÐÓ°ÉÔ­´´ experience much better. <\/li>\n<\/ul>\n\n\n\n<h2 id=\"what-wcag-says\" class=\"wp-block-heading\">What WCAG says<\/h2>\n\n\n\n<p>From WAVE: The &lt;th&gt; element helps associate table cells with the correct row\/column headers. A &lt;th&gt; that contains no text may result in cells with missing or incorrect header information.<\/p>\n\n\n\n<p>(Be sure to <a href=\"https:\/\/app.pope.tech\/result-documentation\">learn more about errors and alerts<\/a>.)<\/p>\n\n\n\n<p>From WCAG: <\/p>\n\n\n\n<p>&#8220;Tables without structural markup to differentiate and properly link between header and data cells, create accessibility barriers. Relying on visual cues alone is not sufficient to create an accessible table.&#8221;<\/p>\n\n\n\n<p><a href=\"https:\/\/www.w3.org\/WAI\/WCAG21\/Understanding\/section-headings\">Learn more about WCAG says about this issue<\/a><\/p>\n","protected":false},"excerpt":{"rendered":"<p>Accessibility Tables can be used to display the kind of information that is appropriate, and that kind of data only. It has to be created in a specific manner to optimize its accessibility. Reason Tables can be a difficult feature to navigate on a web page, especially if it does not contain a table header [&hellip;]<\/p>\n","protected":false},"author":6,"featured_media":0,"parent":0,"menu_order":0,"comment_status":"closed","ping_status":"closed","template":"","meta":{"_acf_changed":false,"_cu_dining_location_slug":"","footnotes":"","_links_to":"","_links_to_target":""},"cu_page_type":[18,14,21],"class_list":["post-21070","page","type-page","status-publish","hentry","cu_page_type-accessibility","cu_page_type-general","cu_page_type-page-organization"],"acf":{"cu_post_thumbnail":""},"_links":{"self":[{"href":"https:\/\/carleton.ca\/webaccessibility\/wp-json\/wp\/v2\/pages\/21070","targetHints":{"allow":["GET"]}}],"collection":[{"href":"https:\/\/carleton.ca\/webaccessibility\/wp-json\/wp\/v2\/pages"}],"about":[{"href":"https:\/\/carleton.ca\/webaccessibility\/wp-json\/wp\/v2\/types\/page"}],"author":[{"embeddable":true,"href":"https:\/\/carleton.ca\/webaccessibility\/wp-json\/wp\/v2\/users\/6"}],"replies":[{"embeddable":true,"href":"https:\/\/carleton.ca\/webaccessibility\/wp-json\/wp\/v2\/comments?post=21070"}],"version-history":[{"count":5,"href":"https:\/\/carleton.ca\/webaccessibility\/wp-json\/wp\/v2\/pages\/21070\/revisions"}],"predecessor-version":[{"id":21318,"href":"https:\/\/carleton.ca\/webaccessibility\/wp-json\/wp\/v2\/pages\/21070\/revisions\/21318"}],"wp:attachment":[{"href":"https:\/\/carleton.ca\/webaccessibility\/wp-json\/wp\/v2\/media?parent=21070"}],"wp:term":[{"taxonomy":"cu_page_type","embeddable":true,"href":"https:\/\/carleton.ca\/webaccessibility\/wp-json\/wp\/v2\/cu_page_type?post=21070"}],"curies":[{"name":"wp","href":"https:\/\/api.w.org\/{rel}","templated":true}]}}