Table

Selector
table, tr, th, td

Don't use these for layout! Tables are useful for easily presenting data in two dimensions. The markup involved is fairly verbose, each table will have two direct children: tbody and thead. Each of those will then have tr elements surrounding td elements or th elements. The table can also optionally have a caption as a direct child to provide a useful description for the table.

Yearly mango exports for countries
Country Market Share Export Value YoY Growth
Thailand 15.25% $570.65M -8.74%
Mexico 12.29% $459.8M +3.15%
Netherlands 11.1% $415.6M +13.08%
Peru 11.1% $415.5M +51.88%
Brazil 6.81% $254.96M +11.39%

The scope attribute on the th element is useful and can also be used within the table body to make tables with two headers. This can be done to the previous table to more explicity associate each country with its mango export performance.

Yearly mango exports for countries
Country Market Share Export Value YoY Growth
Thailand 15.25% $570.65M -8.74%
Mexico 12.29% $459.8M +3.15%
Netherlands 11.1% $415.6M +13.08%
Peru 11.1% $415.5M +51.88%
Brazil 6.81% $254.96M +11.39%

For particularly dense and wide tables, you can use the .striped class to make it easier for users to visually parse the table. The class will add a light background to every other row in the table.

Name Avg Weight Color Shape Tasty?
Tommy Atkins 500g Orangey yellow Ovoid Yes
Kent 650g Strong yellow Rounded, no beak Yes
Osteen 600g Violet purple Oblong, small beak Yes
Haden 560g Yellowy red Oval Yes
Super scientific information about some mango varieties