[Discuss] HTML formatting question

Adam Parkin pzelnip at telus.net
Fri Oct 13 14:14:49 PDT 2006


Replies combined below...

Lloyd D Budd wrote:
> On 10/13/06, Adam Parkin <pzelnip at telus.net> wrote:
>> I have an HTML document which has sections of <pre>formatted text, and
>> what I want is for different parts of the text inside the <pre></pre>
>> block to be coloured different colours.
> 
> You seem kind of hung up on using pre? Why not just define your own
> formatting using basic CSS rules?
> 

Hmm, because I don't really know CSS, nor am I particularly interested 
in learning it, and more importantly every time I've ever tried to do 
anything with CSS it's taken *forever* to get things just the way I want 
with it. =8-p


Thomas McVeigh wrote:
> 
> What I think you want is blockquote.
>  Syntax:
>     <blockquote> ... </blockquote>

Actually, I knew about blockquote, but the pre tags were being (largely) 
used to save me the hassle of putting a <br> at the end of every line. 
So, no, blockquote isn't actually what I'm looking for.


Ronald Schouten wrote:
> I think the problem you are running into is that <pre> elements cannot be
> nested within <pre> elements and <font> tags are just plain wrong
> (deprecated) and will through an error no matter where they are. Without
> knowing what you want to contain in the <pre> element and why I would
> recommend using <span> elements or other more semantic mark-up to further
> identify and style your text.
> 

Well, snide comments about the "wrongness" of my HTML skillz aside, if 
it helps what this is for is a tutorial document for UVic showing 
students how to run the SML/NJ interpreter in the labs.  I have chunks 
of output showing sessions with the interpreter which may look something 
like:

- fun foo x = x * x;
val x = fn : int -> int
- foo (3);
val it = 9 : int

The "fun foo x = x * x;" and "foo (3)" is typed by the user, and 
everything else is output from the interpreter.  Now what I want is to 
have what the user types in coloured red, and what the interpreter spits 
back coloured blue.  Furthermore, I'd like to avoid the hassle of 
manually putting in <br> tags after every line (there are large chunks 
of output I'd like to just copy & paste over, and colour blue without 
adding a whole bunch of markup just to make it look like it does on the 
screen).

The document as it stands now can be seen at:

http://www.csc.uvic.ca/~aparkin/sml.html

-- 
--
Adam Parkin
E-mail: pzelnip at telus.net
----------------------
"A fractal is by definition a set for which the Hausdorff Besicovitch
dimension strictly exceeds the topological dimension."
	-- Mandelbrot, "The Fractal Geometry of Nature"


More information about the Discuss mailing list