- 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://w3schools.tw/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://w3schools.tw/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://w3schools.tw/lib/w3codecolors.js"></script>
</body>
</html>
結果
驗證結果。
廣告