Can I have elements inside pre?

I want to change color

one piece of text inside <pre>

. But I don't want to change color

all the text

I know I can style <pre>

like:

pre{
    ...
}

      

But this will apply it to all text :(

Is there some way to avoid <span>

and put it inside <pre>

so I can do something like:

pre span{
    ...
}

      

If not, what other parameters do I have?

+3


source to share


1 answer


From what I read I think you are looking for something like this. http://jsfiddle.net/3guQ7/



<div>
<pre>
     In not Green
    <span>Im green</span>
</pre>
<div>

pre span{
    color: green;        
}​

      

+6


source







All Articles