Visit Mozilla.org

MDC talk:Custom CSS Classes

From MDC

CSS class needed I think we should be able to have code decorated beyond the current state of arts. I'm working on XPIDL:Syntax and I would like to have the XPIDL BNF with links from non-terminal references to its declaration. Currently I'm managing this by using style attribute for div, but then P tags (wiki generated P tags) are too separated from each other. I'm proposing a new class for divs which is fine for code writting and also lets wiki text to be used (templates, links, an so on) it would be like this:

  div.code {
     display: block;
     border: 1px dashed black;
     padding: 3px;
     background-color:#EEEEEE;
     white-space: pre;
     font-family: monospace;
     font-size: 1.2em;
  }

  div.code p {
     margin: 1em 3px; /* Or whatever looks good for code */
  }

This way we can do something like

  <div class="code">
       {{xpidl-bnf-decl|xpidl-comment}} := '/*' {{xpidl|any-char}} '*/'
  </div>

And it would generate code just like (but spaced better):

xpidl-comment := '/*' any-char '*/'

Manu 17:16, 6 October 2005 (PDT)

If you want your wiki markup to work in codeblocks, instead of using "pre", just indent the entire block (including any whitespace) by 1 space. Like so:

xpidl-comment := '/*' any-char '*/'

Hope that helps.

-- dria 18:32, 6 October 2005 (PDT)


Yes, it works. I thought that indenting would do the same as "pre" -- Manu 19:38, 7 October 2005 (PDT)

[edit] Caution

While migrating the NSPR API Reference a class of "caution" could be used, even in the meantime just a mirror of the note class, so that, in the future we can change style with it if needed and have no semantically considered styles affected. --Callek 16:15, 7 February 2006 (PST)

We already have 'note' and 'warning', is it not enough? --Nickolay 04:52, 8 February 2006 (PST)

[edit] "Bad Example" class

How about a "bad example" class, to highlight that a given example is not the way to do things? Example:

This is not the way to do it:

  bad code example

I could use "warning", but it's not exactly right, is it?

beaufour 09:13, 17 April 2006 (PDT)