Heads up! To view this whole video, sign in with your Courses account or enroll in your free 7-day trial. Sign In Enroll
Well done!
You have completed HTML Tables!
You have completed HTML Tables!
Preview
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.
HTML Elements
- <caption> - The caption element represents the title of the table.
Resources
Related Discussions
Have questions about this video? Start a discussion with the community and Treehouse staff.
Sign upRelated Discussions
Have questions about this video? Start a discussion with the community and Treehouse staff.
Sign up
Last but not least, is the caption
element.
0:00
This element is basically a title for the
table,
0:03
and it should come immediately after the
opening table tag.
0:06
This is nice to add because it quickly
summarizes what a table might contain.
0:11
Some screen rating software and search
engines might pick up
0:15
on a caption, which is much better than
reading one
0:19
table cell at a time and using that
information to
0:22
try to get an idea of what a table is
about.
0:25
So, let's take a look.
0:28
So what I mean, just open up my preview so
we can
0:29
take a look at what the work space should
look like right now.
0:34
And let's go back to the code, and right
after the opening table tag,
0:38
I'm going to type caption, and workspaces
will automatically
0:44
close that for me, and inside, I'll type
employee
0:50
information, because that's generally what
this table contains.
0:58
Employee information.
1:02
So let me switch back to my preview,
refresh the page, and now
1:04
you can see that there's this nice title
up at the top of the table.
1:09
Using CSS, you can hide this caption if
you'd like, but it's
1:15
nice to display it if you want a title for
the table visible.
1:20
You need to sign up for Treehouse in order to download course files.
Sign upYou need to sign up for Treehouse in order to set up Workspace
Sign up