[pmwiki-users] Proposed Default Stylesheet (pmwiki.css)

Joachim Durchholz jo at durchholz.org
Fri Feb 17 18:28:03 CST 2006


Patrick R. Michaud schrieb:
> 
> Somewhere in the back of my mind I have the impression that for some time
> 'ex' wasn't implemented in many browsers.  But I could be wrong there.

Dunno.

> However, there's a very interesting article that recommends 'ex' units
> for all units at http://kb.mozillazine.org/Em_units_versus_ex_units .

That article is restricted to the way the Gecko engine is doing things.

Also, the arguments in the article don't apply anymore if the CSS does 
things like font-size:97%.

These aspects reduce the applicability of the arguments given in the 
article.

> Ultimately  I don't think PmWiki should automatically eat blank 
> lines after headings.  Better is to use CSS to style those blank
> lines as we want:
> 
>     h1 + p.vspace { margin-top: ...  }
> 
> (Unfortunately, IE 6 doesn't support the CSS "+" selector yet.)

I'd try to avoid that if at all possible. Using "+" means you have to 
revisit a lot of corner cases, such as "<h2> after <h1>", "<h3> after 
<h1>", ..., "<h6> after <h1>", "<hr> after <h1>"; repeat for <h2>, <h3> 
etc. etc. etc. - horror!

OK, headers could be styled using a CSS class, so it would be
   .header + p.vspace { margin-top: ... }
but I'm still feeling uneasy. It's special-case handling for a common 
case, but it's very, very likely to break as soon as uncommon cases crop 
up. A set of orthogonal rules is better, and CSS margins provide exactly 
that.
A little-known detail that might help is that vertical margins overlap. 
I.e. if two HTML elements are vertically adjacent, only the larger 
margin will be used. In yet other words, the margin is just a *minimum 
distance* to the next element. (Padding does not have this overlapping 
behaviour. Horizontal margins don't, either.) (Caveat: that's the way I 
read the CSS standard. I haven't found the time to test how real 
browsers handle this - and I don't have a way to test with minority 
browsers anyway.)


Here's an alternative:
Make lines that start with ! eat the following blank line if it exists. 
That way, if a page author truly wants more empty space after a heading, 
he can insert two empty lines.
(Maybe too subtle... but empty lines after headings are subtle no matter 
what.)

On a tangent, I noticed that PmWiki has an interesting deviant behavior 
if a ! line is followed with [@: it will run the preformatted text into 
the header. I.e.

!!Header
[@
lorem ipsum
@]

will give

<h2>header <pre>lorem ipsum</pre></h2>

which isn't quite what I expected. (Quoting from memory, so I may have 
gotten some details wrong.)


Regards,
Jo




More information about the pmwiki-users mailing list