ajax333221
ajax333221

Reputation: 11774

Can I have elements inside a pre?

I want to change the color of a single piece of text inside a <pre>. But I do NOT want to change the color of the whole text

I am aware I can style the <pre> like:

pre{
    ...
}

But that will apply it to the entire text :(

Can I somehow escape a <span> and place it inside the <pre> so I can do something like:

pre span{
    ...
}

If not, what other options do I have?

Upvotes: 5

Views: 5501

Answers (1)

laymanje
laymanje

Reputation: 833

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

pre span{
    color: green;        
}
<div>
<pre>
    In not Green
    <span>Im green</span>
</pre>
<div>

Upvotes: 7

Related Questions