- From: Christian Ottosson <christian@ottosson.name>
- Date: Thu, 29 Jul 2004 23:22:15 +0200
- To: www-html@w3.org
At 09:37 +0200 2004-07-28, fantasai wrote: >Karl Dubost wrote: >> Le 26 juil. 2004, à 13:11, fantasai a écrit : >>> How would you distinguish between an inline code snippet >>> and a block of code, which needs to be formatted as a >>> block and needs all its whitespace presented, etc.? >> display: block; >> display: inline; > >What, you mean to use a 'style' attribute to distinguish >whether the code is a short fragment or a complete block? Hello fantasai and others! Is there a semantic difference between a short and a long sequence of code? Whitespace should of course be presented appropriate for good readability. In my markup I will probably consider code inside a paragraph as a short/inline fragment and code directly in a section as a complete block. Exceptions can be classed different. Thus I will write: <section> <p>To increase <var>i</var> I use <code>i++</code> in each loop.</p> </section> and <section> <h>Adding a bike</h> <p>I have written a separate method to add a bike.</p> <code> private void addBike() { /* very interesting code here */ } </code> </section> As css I can use (and [hope my browser will/tell by browser to] use as default): section > code { display: block; /* whitespace as appropriate */ } section p code { display: inline; /* whitespace as appropriate */ } -- Christian Ottosson http://christian.ottosson.name/ () ASCII Ribbon Campaign -- against HTML mail & vCards /\ http://arc.pasp.de/
Received on Thursday, 29 July 2004 17:24:38 UTC