What is meta? ×
Meta Stack Exchange is where users like you discuss bugs, features, and support issues that affect the software powering all 129 Stack Exchange communities.

Possible Duplicate:
Syntax highlighting language hints

There are some languages that get highlighted incorrectly. Is it possible to specify a code block that does not have any highlighting when it gets displayed?

Here is an small example of CSS that is getting highlighted as if it was C/C++.

#div.a {
  background-color: #000000;
}

.static {
}
share|improve this question

migrated from stackoverflow.com Nov 3 '09 at 4:20

This question came from our site for professional and enthusiast programmers.

marked as duplicate by Shog9 Jul 22 '12 at 17:27

This question has been asked before and already has an answer. If those answers do not fully address your question, please ask a new question.

2 Answers 2

You can display a block without color by using a <pre> block.

#div.a {
    background-color: #000000;
}

.static {

}

And I think StackOverflow is using Google Code Prettify, but I haven't figured out how to get it to show CSS yet (though it claims it should, attaching class="prettyprint lang-css" in a pre tag doesn't seem to work.).

CORRECTION: Oops, apparently StackOverflow uses Google Code Prettify not syntaxhighlighter as was previously posted, thx for the correction shog9, it's always nice to have the right information. Despite the correction, the class="prettyprint lang-css" attribute still doesn't seem to work, even with supported languages such as C.

share|improve this answer
    
It will highlight CSS if the lang-css class is present AND lang-css.js is loaded. Per-language support does not work if the language specific handler is not loaded. –  Mike Samuel Dec 10 '09 at 18:29

Actually, it's Google Code Prettify.

As Akdom noted, you can just use a <pre> tag and leave out the prettyprint class to get a plain ol' code listing. Alternately, we support special comment prefixes to force language-specific highlighting (or turn highlighting off altogether):

<!-- language: lang-css -->

...will properly highlight CSS syntax, while

<!-- language: lang-none -->

...will turn it off.

share|improve this answer