CSS Tables

Using CSS Tables a developer has more scope on the styling and feel of the table elements.

In general, there are 6 HTML elements that deal with tables:

  • table – the table itself
  • thead – the header of the table
  • tbody – the main content of the table
  • tfoot – the footer of the table
  • tr – a table row
  • th – a table heading
  • td – a table cell

Each of these elements can be styled using traditional CSS declarations. There are certain table-specific attributes that can also be declared though:
border-collapse – if you have a table with a 1px border on every cell, then all joining borders will appear to be 2 pixels thick. Collapsing the borders make the browser act as if they are one singular border.
vertical-align – it is possible to align elements vertically within a table cell. Similar to the valign HTML attribute, this can be set to ‘top’, ‘middle’ or ‘bottom’.

Using all of these in conjunction can create a nice effect.

Share and Enjoy:
  • Print
  • Digg
  • Sphinn
  • del.icio.us
  • Facebook
  • Mixx
  • Google Bookmarks
  • email
  • FriendFeed
  • LinkedIn
  • Live
  • MSN Reporter
  • MySpace
  • PDF
  • Ping.fm
  • Posterous
  • Reddit
  • RSS
  • Slashdot
  • StumbleUpon
  • Suggest to Techmeme via Twitter
  • Technorati
  • Tumblr
  • Twitter
  • Yahoo! Bookmarks
  • Yahoo! Buzz
This entry was posted on Saturday, January 16th, 2010 at 1:53 am and is filed under CSS Tutorials. You can follow any responses to this entry through the RSS 2.0 feed. You can leave a response, or trackback from your own site.

Post a Comment