{"id":2431,"date":"2017-05-08T20:42:29","date_gmt":"2017-05-08T20:42:29","guid":{"rendered":"http:\/\/cssreset.com\/?p=2431"},"modified":"2017-08-02T20:26:11","modified_gmt":"2017-08-02T20:26:11","slug":"modern-uses-for-tables","status":"publish","type":"post","link":"https:\/\/cssdeck.com\/blog\/modern-uses-for-tables\/","title":{"rendered":"Modern Uses for Tables"},"content":{"rendered":"<p dir=\"ltr\">The possibilities when it comes to coding have become diverse, incredibly trendy and very advanced. Tables, which were one of the first tools a developer had to create a grid, are still considered useful for certain things, despite the many ways that web development has evolved. It\u2019s a way of storing and presenting data that is acceptable everywhere. It\u2019s a useful way to organize information for your users. Another great use for tables is in email templates. It\u2019s actually recommended to use tables exclusively because of the issues presented by sending content to so many types of email clients and devices. In this article we\u2019ll go over styling tables with CSS for web development and for email marketing.<\/p>\n<p dir=\"ltr\">First, let&#8217;s look at a few different tables types and designs&#8230;<\/p>\n<p dir=\"ltr\"><strong>Basic Data Table<\/strong><\/p>\n<p dir=\"ltr\">Displaying your data on a table is good for readers because it\u2019s the easiest way to read a lot of information in one place. If you are still learning how to code, it might be a little confusing because, though writing code goes from left to right, up to down, coding for a table can get weird. It\u2019s really good to keep in mind that coding tables are filled out by rows. Those rows are then filled in with data cells. Make sure to create separate sheets for HTML and CSS, and link to the CSS sheet on the HTML sheet in the &lt;head&gt; section. Here\u2019s an example of the code that will create a straightforward table where you can organize data:<\/p>\n<p dir=\"ltr\"><a href=\"https:\/\/cssdeck.com\/blog\/\/wp-content\/uploads\/2017\/04\/Screen-shot-2017-04-25-at-17.23.46-.png\"><img decoding=\"async\" loading=\"lazy\" alt=\"Screen shot 2017-04-25 at 17.23.46\" src=\"https:\/\/cssdeck.com\/blog\/\/wp-content\/uploads\/2017\/04\/Screen-shot-2017-04-25-at-17.23.46--222x300.png\" width=\"222\" height=\"300\" \/><\/a><\/p>\n<p dir=\"ltr\">To copy and paste the code, follow this link:\u00a0<a href=\"https:\/\/codepen.io\/imrizzy\/pen\/ZKpoyL\">https:\/\/codepen.io\/imrizzy\/pen\/ZKpoyL<\/a><\/p>\n<p dir=\"ltr\">And here&#8217;s the CSS code:<\/p>\n<pre>table, th, td {\r\n\tborder: 1px solid black;\r\n}<\/pre>\n<p dir=\"ltr\">As the columns grow, you may have trouble reading the data because of the amount of information being displayed. It\u2019s easier on the eyes to add background color to every other row by adding the following code to the main.css file:<\/p>\n<pre>tr:nth-child(2n) {\r\n    background: lime;\r\n}<\/pre>\n<p dir=\"ltr\">As bland as tables might sound, you can always get creative with the little things. For example, adding cellpadding to each data cell. This allows for buffer space between the words and cell walls. Or, you can make the category names different colors, causing them to stand out from the rest of the table. That would make the categories more clear amongst all the other cells. You can play with border colors and thickness, or even highlight the entire row your cursor is hovering over in a different color using with the code below:<\/p>\n<pre>tr:hover {\r\n    background: yellow;\r\n}<\/pre>\n<p dir=\"ltr\">If you want just the cell to be highlighted, then you can change the \u201ctr\u201d to \u201ctd\u201d. Finally, of course, you can change the background color to your preferred hue!<\/p>\n<p dir=\"ltr\"><strong>Using Tables in Email Templates<\/strong><\/p>\n<p dir=\"ltr\">Creating email templates is not the easiest, considering you have to know what kind of information you want to present and exactly how you want it be formatted. Luckily, most of the web audience these days is on mobile. If this is true of your audience you have the option of just placing each section below the previous one, like building blocks. Here\u2019s a Warner Music Group email that I coded onto my Codepen:\u00a0<a href=\"https:\/\/codepen.io\/imrizzy\/pen\/Lxqpje?editors=1000#0\">https:\/\/codepen.io\/imrizzy\/pen\/Lxqpje?editors=1000#0<\/a>.<\/p>\n<p dir=\"ltr\"><a href=\"https:\/\/cssdeck.com\/blog\/\/wp-content\/uploads\/2017\/04\/Screen-shot-2017-04-25-at-16.27.39-.png\"><img decoding=\"async\" loading=\"lazy\" alt=\"Screen shot 2017-04-25 at 16.27.39\" src=\"https:\/\/cssdeck.com\/blog\/\/wp-content\/uploads\/2017\/04\/Screen-shot-2017-04-25-at-16.27.39--300x248.png\" width=\"300\" height=\"248\" \/><\/a><\/p>\n<p dir=\"ltr\">You\u2019ll notice the CSS is in the HTML file in this example and that\u2019s okay for email templates. It\u2019s less complicated to have it all in one file. In fact, it\u2019s protocol to have the stylings of each data cell be inline. This is the best way to work with email templates and most tables in general. Although, it\u2019s not completely wrong to have them in separate sheets.<\/p>\n<p><strong>Conclusion<\/strong><\/p>\n<p>You may not consider tables to be the most exciting thing, but there\u2019s definitely a lot of styling you can do if you know what your options are for attributes. It\u2019s something worth exploring because tables are the most basic form of coding, and knowing the fundamentals is always key. Furthermore, if email template creation is a big part of your work, you will definitely want to use styling tables as this coding is accepted and understood by all mail clients. Happy coding!<\/p>\n<div class=\"wp-socializer wpsr-share-icons \" data-lg-action=\"show\" data-sm-action=\"show\" data-sm-width=\"768\" ><h3>Share and Enjoy !<\/h3><div class=\"wpsr-si-inner\"><div class=\"wpsr-counter wpsrc-sz-32px\" style=\"color:#000\"><span class=\"scount\"><span data-wpsrs=\"\" data-wpsrs-svcs=\"facebook,twitter,linkedin,pinterest,print,pdf\">0<\/span><\/span><small class=\"stext\">Shares<\/small><\/div><div class=\"socializer sr-popup sr-32px sr-circle sr-opacity sr-pad sr-count-1 sr-count-1\"><span class=\"sr-facebook\"><a rel=\"nofollow\" href=\"https:\/\/www.facebook.com\/share.php?u=\" target=\"_blank\"  title=\"Share this on Facebook\"  style=\"color: #ffffff\" ><i class=\"fab fa-facebook-f\"><\/i><span class=\"ctext\"><span data-wpsrs=\"\" data-wpsrs-svcs=\"facebook\">0<\/span><\/span><\/a><\/span>\n<span class=\"sr-twitter\"><a rel=\"nofollow\" href=\"https:\/\/twitter.com\/intent\/tweet?text=%20-%20%20\" target=\"_blank\"  title=\"Tweet this !\"  style=\"color: #ffffff\" ><i class=\"fab fa-twitter\"><\/i><\/a><\/span>\n<span class=\"sr-linkedin\"><a rel=\"nofollow\" href=\"https:\/\/www.linkedin.com\/sharing\/share-offsite\/?url=\" target=\"_blank\"  title=\"Add this to LinkedIn\"  style=\"color: #ffffff\" ><i class=\"fab fa-linkedin-in\"><\/i><\/a><\/span>\n<span class=\"sr-pinterest\"><a rel=\"nofollow\" href=\"https:\/\/www.pinterest.com\/pin\/create\/button\/?url=&amp;media=&amp;description=\" target=\"_blank\"  title=\"Submit this to Pinterest\"  style=\"color: #ffffff\" data-pin-custom=\"true\"><i class=\"fab fa-pinterest\"><\/i><span class=\"ctext\"><span data-wpsrs=\"\" data-wpsrs-svcs=\"pinterest\">0<\/span><\/span><\/a><\/span>\n<span class=\"sr-print\"><a rel=\"nofollow\" href=\"https:\/\/www.printfriendly.com\/print?url=\" target=\"_blank\"  title=\"Print this article \"  style=\"color: #ffffff\" ><i class=\"fa fa-print\"><\/i><\/a><\/span>\n<span class=\"sr-pdf\"><a rel=\"nofollow\" href=\"https:\/\/www.printfriendly.com\/print?url=\" target=\"_blank\"  title=\"Convert to PDF\"  style=\"color: #ffffff\" ><i class=\"fa fa-file-pdf\"><\/i><\/a><\/span><\/div><\/div><\/div>","protected":false},"excerpt":{"rendered":"<p dir=\"ltr\">The possibilities when it comes to coding have become diverse, incredibly trendy and very advanced. Tables, which were one of the first tools a developer had to create a grid, are still considered useful for certain things, despite the [&#8230;]<\/p>\n<p><a class=\"more-link article\" href=\"https:\/\/cssdeck.com\/blog\/modern-uses-for-tables\/\" title=\"Click to read 'Modern Uses for Tables'\">Read Article<\/a><\/p>\n","protected":false},"author":18,"featured_media":0,"comment_status":"open","ping_status":"open","sticky":false,"template":"","format":"standard","meta":[],"categories":[6],"tags":[],"_links":{"self":[{"href":"https:\/\/cssdeck.com\/blog\/wp-json\/wp\/v2\/posts\/2431"}],"collection":[{"href":"https:\/\/cssdeck.com\/blog\/wp-json\/wp\/v2\/posts"}],"about":[{"href":"https:\/\/cssdeck.com\/blog\/wp-json\/wp\/v2\/types\/post"}],"author":[{"embeddable":true,"href":"https:\/\/cssdeck.com\/blog\/wp-json\/wp\/v2\/users\/18"}],"replies":[{"embeddable":true,"href":"https:\/\/cssdeck.com\/blog\/wp-json\/wp\/v2\/comments?post=2431"}],"version-history":[{"count":5,"href":"https:\/\/cssdeck.com\/blog\/wp-json\/wp\/v2\/posts\/2431\/revisions"}],"predecessor-version":[{"id":2463,"href":"https:\/\/cssdeck.com\/blog\/wp-json\/wp\/v2\/posts\/2431\/revisions\/2463"}],"wp:attachment":[{"href":"https:\/\/cssdeck.com\/blog\/wp-json\/wp\/v2\/media?parent=2431"}],"wp:term":[{"taxonomy":"category","embeddable":true,"href":"https:\/\/cssdeck.com\/blog\/wp-json\/wp\/v2\/categories?post=2431"},{"taxonomy":"post_tag","embeddable":true,"href":"https:\/\/cssdeck.com\/blog\/wp-json\/wp\/v2\/tags?post=2431"}],"curies":[{"name":"wp","href":"https:\/\/api.w.org\/{rel}","templated":true}]}}