DIV CSS 佈局教程網

您现在的位置: DIV+CSS佈局教程網 >> 網頁腳本 >  >> HTML基礎知識 >> 關於HTML
網站首頁 head 區域的撰寫規範
編輯:關於HTML     

head 區域位於 HTML 文件的 <head> 與 </head> 之間,主要用來提供瀏覽器與搜尋引擎所需的頁面資訊。以下整理首頁 head 區常見的撰寫項目。

一、必須加入的標籤

1. 版權或設計資訊註解

例如:<!-- The site is designed by Example Inc. -->

2. 網頁顯示字元集

簡體中文:<meta http-equiv="Content-Type" content="text/html; charset=gb2312" />
繁體中文:<meta http-equiv="Content-Type" content="text/html; charset=BIG5" />
通用寫法:<meta charset="utf-8" />

3. 網頁作者資訊

<meta name="author" content="webmaster@example.com" />

4. 網站簡介

<meta name="description" content="網站內容簡介" />

5. 搜尋關鍵字

<meta name="keywords" content="關鍵字1,關鍵字2,關鍵字3" />

6. 樣式表連結

<link href="style/style.css" rel="stylesheet" type="text/css" />

7. 網頁標題

<title>網站名稱或頁面標題</title>

二、可選擇加入的標籤

1. 設定頁面到期時間

<meta http-equiv="expires" content="Wed, 26 Feb 1997 08:21:57 GMT" />

2. 禁止從快取讀取

<meta http-equiv="Pragma" content="no-cache" />

3. 防止被框架嵌入

<meta http-equiv="Window-target" content="_top" />

4. 自動跳轉

<meta http-equiv="Refresh" content="5;URL=https://example.com" />

5. 搜尋引擎機器人設定

<meta name="robots" content="index,follow" />

6. 網站圖示

<link rel="shortcut icon" href="favicon.ico" />

三、JavaScript 外部調用

建議將 JavaScript 放在外部檔案中,再透過 script 標籤載入:

<script src="script/main.js" type="text/javascript"></script>

head 區雖然不是使用者直接看到的內容,卻會影響瀏覽器解析、搜尋引擎理解與頁面效能。養成良好撰寫習慣,能讓網站更穩定、更易維護。

XML學習教程| jQuery入門知識| AJAX入門| Dreamweaver教程| Fireworks入門知識| SEO技巧| SEO優化集錦|
Copyright © DIV+CSS佈局教程網 All Rights Reserved