Question: The third code block in [this question](https://stackoverflow.com/questions/7504163/placing-json-values-from-a-json-response-to-html-elements) has the right colors - attribute names are red and the values are blue; whereas in [this other question](https://stackoverflow.com/questions/7504918/how-to-create-a-div-with-vertical-scrollable-contents-and-fixed-footer-which-is-a) colors for the same tokens are black and brown, why is this, and could one do something to enforce correct colors for code?

Answer: 
The problem is the broken post has two tags, [html](/questions/tagged/html "show questions tagged 'html'") and [css](/questions/tagged/css "show questions tagged 'css'"), that both have syntax highlighting associated with them. I don't know how SO decides between them, but for some reason it's decided to go with CSS syntax highlighting for the whole page, even though that code snippet is actually in HTML. In cases like this the language can be set manually, using `<!-- language: lang-XXX -->`.

For example ([markdown](https://meta.stackoverflow.com/revisions/0d6c7382-c45d-431f-a128-b11294fb4624/view-source)), this version is `lang-html`:

```html
<div id="dialog-window">
  <div id="scrollable-content">
    what ever content here...div's, ul's and li's
  </div>
  <div id="footer">
  </div>
</div>

```

This is `lang-css`:

```css
<div id="dialog-window">
  <div id="scrollable-content">
    what ever content here...div's, ul's and li's
  </div>
  <div id="footer">
  </div>
</div>

```

The list of available languages is [here](https://meta.stackexchange.com/questions/72082/changes-to-syntax-highlighting)

---

**Edit**: I just noticed this in Jeff's post:

> 
> If a question has two tags that both define specific languages, it uses default and lets prettify infer as it always has.
> 
> 
> 

So either prettify is guessing completely wrong, or that feature doesn't appear to work right
See <https://stackoverflow.com/editing-help#syntax-highlighting> - you need to specify the language explicitly or you have to live with the fact that the automatic detection might go wrong. I added the necessary comment to the second question and now it also highlights the text correctly.