Bummer! This is just a preview. You need to be signed in with a Treehouse account to view the entire video.
The Caption Element1:25 with Nick Pettit
The caption element is basically a title for the table, and it should come immediately after the opening table tag. This is nice to add because it quickly summarizes what a table might contain.
- <caption> - The caption element represents the title of the table.
Last but not least, is the caption element.
This element is basically a title for the table,
and it should come immediately after the opening table tag.
This is nice to add because it quickly summarizes what a table might contain.
Some screen rating software and search engines might pick up
on a caption, which is much better than reading one
table cell at a time and using that information to
try to get an idea of what a table is about.
So, let's take a look.
So what I mean, just open up my preview so we can
take a look at what the work space should look like right now.
And let's go back to the code, and right after the opening table tag,
I'm going to type caption, and workspaces will automatically
close that for me, and inside, I'll type employee
information, because that's generally what this table contains.
So let me switch back to my preview, refresh the page, and now
you can see that there's this nice title up at the top of the table.
Using CSS, you can hide this caption if you'd like, but it's
nice to display it if you want a title for the table visible.
You need to sign up for Treehouse in order to download course files.Sign up