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