As an explanation, to turn:
Code: Select all
<p>some text</p>
<pre>
public function hello() {
echo 'Hello';
}
</pre>Code: Select all
<p>some text</p>
<p><span style="font-weight: bold;">php:</span></p>
<pre>
public function hello() {
echo 'Hello';
}
</pre>I played around with:
Code: Select all
#bodyContent p + pre.php:before {
content: "<p><span style=\"font-weight: bold;\">php code:</span></p>";
}The problem of course is that it's added to the start of the <pre> element and so the HTML is not being parsed by the browser. Altering the original HTML is very difficult and so I was hoping there was some way around having to go editing source code...
Any way of applying a style to a preceeding element using CSS2 selectors? Opposite of p + pre (in the case above).