Logo Questions Linux Laravel Mysql Ubuntu Git Menu
 

Can I have elements inside a pre?

Tags:

css

escaping

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?

like image 806
ajax333221 Avatar asked Apr 02 '12 20:04

ajax333221


1 Answers

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>
like image 95
laymanje Avatar answered Sep 30 '22 03:09

laymanje