The default syntax highlighter uses a "one size tries to fit all" approach, which will not always be successful. I have changed the setting for the css tag such that not the default highlighter, but the CSS-specific highlighter is used for questions with this tag (example).
In general, you can also manually specify which highlighter is to be used, by inserting
<!-- language: lang-css -->
right before the corresponding codeblock. See the syntax highlighting section in the editing help for details, and this answer on meta.so for a list of supported highlighters.