Undergraduate Teaching 2023-24

Administrative information: working with tables in Drupal

Administrative information: working with tables in Drupal

Not logged in. More information may be available... Login via Raven / direct.

Tables are difficult to work with in html (the underlying language of the web), and this is compounded in our 'responsive' web pages in Drupal, which are designed to be able to dynamically resize to fit whatever screen width is available.  Furthermore, the tables also have to be rendered in a sensible way as a pdf download, which are rendered in yet another fashion.  However, good-looking tables are possible with care: below are some hints.  It's almost certainly necessary to work with the 'Source' code for the table, not just the Drupal WYSIWYG editor.

Some things not to do

  • Don't just paste a table from Word.
  • Don't use a fixed width for the tables or columns (e.g. something measured in pixels, px).  Use a % width if necessary.
  • Don't change the size of a table with the Drupal WYSIWYG editor.  It will end up defining the size in pixels.
  • Don't put <p> and </p> paragraph marks inside a table entry unless it does contain paragraphs and not just a single entry: it leaves a lot of superfluous space.

Some things to do

  • Use a package such as Adobe Dreamweaver to develop the table.
  • 'Cut' information from tables and paste into Excel, and then cut from Excel and paste into Dreamweaver.  This seems to get rid of superfluous formatting information.
  • Specify widths as %
  • Enclose the header line in <thead> and </thead> tags, and the body in <tbody> and </tbody> tags (not done by default in Dreamweaver).  This is rendered by Drupal with a nice contrasting header style.

An example

A link to a good and bad example of a table.

 

Last updated on 08/12/2017 10:53