html

Bill Gribble grib@gnumatic.com
Thu, 8 Mar 2001 08:55:55 -0600


On Thu, Mar 08, 2001 at 01:19:26AM -0800, Dave Peticolas wrote:
> Hi Bill, I was trying to use this code to set the background
> and center everything:
> 
>         (gnc:html-document-set-style!
>          doc "body" 
>          'attribute (list "bgcolor" bg-color)
>          'tag "center")
> 
> If I leave out the 'tag section, the bg color is set.
> But if I include it, everything is centered but the
> bg is never set. Am I using 'tag correctly?

Sort of but not really.  What you are saying above is "everywhere you
would have used <body>, use <center> instead."  The problem with that
is that <center> doesn't support the bgcolor attribute; there are only
a few things that do. 

The style system is pretty limited in this respect ATM; what you'd like
to say is something like 

         (gnc:html-document-set-style!
          doc "body" 
          'attribute (list "bgcolor" bg-color)
	  'extra-markup "center")

which would render to 

<body bgcolor=bg-color><center> .. body ... </center></body>

and of course if you had set some style for <center> it should get
rendered appropriately.

An alternative would be to have top-level support for centering in 
style objects: 

         (gnc:html-document-set-style!
          doc "body" 
          'attribute (list "bgcolor" bg-color)
	  'center #t)

I've been thinking about adding more top-level style primitives so we
can do things like add a background color to paragraphs (which can't
get one with normal HTML, but could if we put them in a table, meaning
the style system would magically add tables where you need to get
background colors).

Neither one would be terribly hard to add (I don't think).  I'll have
a look at it today.

It might be easier to use a top-level table in the meantime.  <td>
supports centering and bgcolor.

b.g.