- W3.CSS教程
- W3.CSS - 主页
- W3.CSS - 概述
- W3.CSS - 环境设置
- W3.CSS - 容器
- W3.CSS - 代码着色
- W3.CSS - 卡片
- W3.CSS - 响应式设计
- W3.CSS - 网格
- W3.CSS - 表单
- W3.CSS - 按钮
- W3.CSS - 工具提示
- W3.CSS - 模态对话框
- W3.CSS - 表格
- W3.CSS - 列表
- W3.CSS - 图像
- W3.CSS - 图标
- W3.CSS - 颜色
- W3.CSS - 导航
- W3.CSS - 实用程序
- W3.CSS 有用资源
- W3.CSS - 快速指南
- W3.CSS - 有用的资源
- W3.CSS - 讨论
W3.CSS - 代码着色
W3.CSS 为以下语言的语法突出显示提供了出色的支持 -
HTML - 在具有 HTML 代码的容器上使用 w3-code htmlHigh 类。
CSS - 在具有 CSS 代码的容器上使用类 w3-code cssHigh。
JS - 在具有 CSS 代码的容器上使用类 w3-code jsHigh。
您必须包含以下脚本才能链接到 js 文件以获得语法突出显示支持 -
<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>
结果
验证结果。