HTML <code> Tag with the 'class' Attribute specifying the Language

You can use <code class="language-css">p {color:green}</code> to change the text color to green.

The <code> element provides no means for formally specifying the language used. However, you can use the class attribute with a value that is prefixed with language-. For example, language-markup, language-css, language-javascript, etc.

If you need to apply more than one class to an element you can separate the class names with a space (for example, class="class1 class2 class3").

About the <code> Element

The <code> element represents a fragment of computer code. Examples of computer code include an HTML or XML element name, a filename, a computer program, or any other string that a computer would recognize.

Most browsers display the contents of the <code> element in a monospaced font (such as Courier) but you can always use style sheets to change this.