W3.CSS - Codificação para Colorir
W3.CSS fornece excelente suporte para realce de sintaxe dos seguintes idiomas -
HTML - Use classes w3-code htmlHigh no contêiner com código HTML.
CSS - Use classes w3-code cssHigh no contêiner com código CSS.
JS - Use classes w3-code jsHigh no contêiner com código CSS.
Você deve incluir o seguinte script para ter um link para o arquivo js para ter o suporte de realce de sintaxe -
<script src = "https://www.w3schools.com/lib/w3codecolors.js"></script>
w3css_color_coding.htm
<html>
<head>
<title>The W3.CSS Syntax Highlighter</title>
<meta name = "viewport" content = "width = device-width, initial-scale = 1">
<link rel = "stylesheet" href = "https://www.w3schools.com/lib/w3.css">
</head>
<body>
<header class = "w3-container w3-teal">
<h2>HTML Syntax Highlighted</h2>
</header>
<div class = "w3-code htmlHigh">
<html>
<head>
<title>The W3.CSS Example</title>
<meta name="viewport" content="width=device-width, initial-scale=1">
<link rel="stylesheet" href="css/w3.css">
</head>
<body>
<header class="w3-container w3-teal">
<h1>Hello World!</h1>
</header>
</body>
</html>
</div>
<header class="w3-container w3-teal">
<h2>CSS Syntax Highlighted</h2>
</header>
<div class = "w3-code cssHigh">
.bold {
font-weight:bold;
}
#boldLabel {
font-weight:bold;
}
table, th, td {
font-family:sans;
}
</div>
<header class = "w3-container w3-teal">
<h2>JS Syntax Highlighted</h2>
</header>
<div class = "w3-code cssHigh">
<script type="text/javascript">
function(message){
}
var message = "Hello, World!";
alert(message);
</script>
</div>
<script src="https://www.w3schools.com/lib/w3codecolors.js"></script>
</body>
</html>
Resultado
Verifique o resultado.