More Table Tips2:04 with Nick Pettit
Tables should only be used for displaying tabular data and not for positioning images and text, because that can now be done with CSS.
If you'd like to learn more about tables, be sure to read the Mozilla Developer Network documentation for the <table> element and other elements that relate to tables.
Back in the 90s and into the 2000s, rendering inconsistencies between 0:00 browsers meant that tables were a good option for web page layout. 0:05 People would create a table, and then would create cells 0:10 to place all of their text and images on the page. 0:14 This worked pretty well at the time because, CSS was still maturing 0:17 and there weren't too many other great ways to get an exact look. 0:22 However, browsers have improved a lot and those days are long behind us. 0:27 So, you should never use tables for layout in a web browser. 0:32 In other words, tables should only be used for displaying tabular data. 0:36 And not for positioning images and text, because that can now be done with CSS. 0:42 There is one major exception to this. 0:49 In HTML emails, tables are still used for layout. 0:51 Because rendering and consistencies, still persists. 0:56 The table that we made is not very interactive, 1:00 so here are two challenges for you to consider. 1:03 If you continue to learn about front end 1:07 development, try adding some jQuery to your table. 1:09 With the right plug-in, you can add features 1:14 like sorting and filtering to an otherwise static table. 1:16 If you learn about back end languages, like Ruby, PHP, or 1:21 Python, try to see if you can populate a table dynamically. 1:25 By using data from a database. 1:30 Databases store information in a table structure. 1:32 So it's very normal to see data from a 1:36 database, rendered in the form of an HTML table. 1:39 This is common in website administration interfaces, 1:44 where you need to manage all of 1:48 your data without writing database queries every time you want to make a change. 1:49 That about wraps things up for HTML tables. 1:55 If there's one thing that you take away from 1:58 this, remember that tables are used for tabular data. 2:00
You need to sign up for Treehouse in order to download course files.Sign up