Starne Bjoustrop
Starne Bjoustrop

Reputation: 29

HTML5 <code> class for the language C++

I saw in this post How can I show code (specifically C++) in an HTML page? an example of how to use HTML5's code tags to format Pascal code:

<pre><code class="language-pascal">var i: Integer;
    begin
        i := 1;
    end.</code></pre>

On my page, I want to format C++ code. So I'll need something like class="language-cpp" (That's a guess). Anyone know what it is? Or is there some documentation where I can see a list of the classes?

Upvotes: 2

Views: 2272

Answers (1)

Joeytje50
Joeytje50

Reputation: 19112

According to the w3 page this code originally came from, this is simply a semantics suggestion, nothing more. This class doesn't affect the browser in any way other than any other class would, and it's simply a recommendation from W3 to use classes like that when highlighting your code.

There is not, and will never be, anything this class will do by itself. You'll have to include a syntax highlighting script for the code to work, and those all will have their own documentation which will all be clear on how to highlight code for C++.

Upvotes: 2

Related Questions