[Pmwiki-users] Styling 'simple' tables

Bronwyn Boltwood arndis
Tue Dec 7 15:38:05 CST 2004


On Wed, 1 Dec 2004 09:44:59 +0000, Ciaran <ciaranj at gmail.com> wrote:
> Hi, Is there an easy way to apply a default style to the simple
> tables.    (Pmwiki1)
> I'd like to be able to default the style to be a font size smaller,
> and the first row's background to be grey for example.  I can easily
> build tables like this with the advanced tables stuff, by my users are
> reticent to use this! :(
> 
> Any ideas? have I missed something patently obvious :)

CSS, my dear, CSS.  :)  You'll need the page source, or better yet,
access to the template, so that you can write the correct CSS
selectors.  The selectors need to be specific enough that they *only*
select the bits you want.  My site uses a template with no tables,
except for ones added by content, and the content lives in <div
id="wikitext"></div>.  Therefore, I can use this CSS, with descendant
(#wikitext table) and first-child (tr:first-child) selectors:

#wikitext table {font-size: 85%;}  /* smaller font size in tables */
#wikitext tr:first-child {background: #ccc;}  /* light grey background
for the first row of the table -- but only in modern browsers, like
Firefox and Opera.  Internet Explorer for Windows does NOT understand
:first-child. */

If I wanted to get fancier with my table headers, I could write: 
#wikitext tr:first-child {background: #ccc; font-size: 90%;
font-weight: bold;}  /* table headers have light grey backgrounds and
bold font which is smaller than the page text but bigger than the
table text. */

The method to add this CSS will vary according to the template.  If
it's already got a stylesheet which you can make changes to, you can
just drop it in there.

If you want or need to learn more, I strongly recommend
http://westciv.com/style_master/academy/css_tutorial/index.html as a
definitive guide.

Bronwyn



More information about the pmwiki-users mailing list