During my short tenure under the CSS tag, I've noticed that code-prettify seems to interpet a naked # character as the beginning of a comment, for example:

#footer a.footA {
    color: #6bc2ef;

The first two lines would be greyed out after their '#' characters, which do not commence comments, but prefix an element ID and a color value, respectively. Is this something totally out of SO's control? Are there really more than a couple of languages that use # for comments?

See Unable to style an anchor tag? Someone explain why? for ample examples.

On a side note, why doesn't meta seem to code-prettify?


1 Answer 1


This is because the default highlighting for those tags is to auto-detect the language (presumably since posts in "webby" tags tend to contain code samples in several languages), and it doesn't always get it right. You can fix this by adding an explicit language annotation before the code block.

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

    .footA:hover {
        color: #6bc2ef; !important

This will cause the correct highlighting to be used which means both no graying out, and as a bonus you get highlighted keywords as well.

You must log in to answer this question.

Not the answer you're looking for? Browse other questions tagged .