I would be happy if MediaWiki could automatically add CSS tags to commands or codes that would not be translated by browsers (such as Google Translate).
The HTML5 translate attribute indicates whether or not the content of any given element should be translated (but, it’s not CSS ).
translate="no" will prevent translation.
translate="yes" allows translation.
If the *translate attribute was added to each page (<html translate="no">) it would also prevent valid translation of normal text – so, that’s not really an option.
However, I imagine the wiki templating for the <pre> element could be modified to prevent translation of commands; something like:
<pre translate="no">
However, the translate attribute is best used with static HTML.
In applications that generate HTML (such as blogs, wikis, etc) there might be a pre-defined setting to allow or disallow translation – much like the <nowiki> tag that @linux-aarhus mentions; though I can neither confirm or deny if that would work, as I’ve personally had limited experience with these kinds of applications.
Using the HTML5 translate attribute might work, but yes, it would assuredly be very labour-intensive.
The general quality of external translation services seems to vary. I’d suggest the onus is really on those services to avoid inadvertantly translating CSS code along with other content.
At least, that seems easier than the alternative of educating content creators to stop using inline CSS within the HTML.
Separation of concerns in coding web content has been greatly encouraged since the early 2000’s, yet a significant portion of content creators (individuals and publishing systems) still remain ignorant or simply ignore it.