[Discuss] HTML formatting question

noel at natnix.com noel at natnix.com
Fri Oct 13 13:26:46 PDT 2006


<!-- Worked (in IE) -->
<pre>
The Quick
  Brown Fox
    <span style="color: red">Humped Rover</span>
  The Lazy
Dog
</pre>

<!-- Didn't work, but should have.  IE ignored the "white-space: pre" style -->
<div style="white-space: pre">
The Quick
  Brown Fox
    <span style="color: red">Humped Rover</span>
  The Lazy
Dog
</div>



On Fri, Oct 13, 2006 at 10:50:46AM -0700, Adam Parkin wrote:
> A question for the HTML gurus out there....
> 
> 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.  I initially tried doing:
> 
> <pre>
> <font color="red">some
> 		text</font>
> <font color="blue">some more
> 		text</font>
> </pre>
> 
> But the w3 validator chokes on this as apparently you cannot have a font 
> tag inside a pre tag.  I thought okay maybe we use styles like so:
> 
> <pre style="color: red">some
> 		text</pre>
> <pre style="color: blue">some more
> 		text</pre>
> 
> But of course the two pre tags cause a carriage return between the two 
> blocks of text (defeating the whole point of using pre in the first place).
> 
> Any suggestions?
> -- 
> --
> Adam Parkin
> E-mail: pzelnip at telus.net
> ----------------------
>  If one man offers you democracy and another offers you a bag of grain, 
> at what stage of starvation will you prefer the grain to the vote?
> 	-- Bertrand Russell
> _______________________________________________
> Discuss mailing list
> Discuss at vlug.org
> http://ladybug.vlug.org/cgi-bin/mailman/listinfo/discuss


More information about the Discuss mailing list