HTML 4.01 快速導覽 - <base> 基本路徑標籤

<base /> 標籤 (tag) 提供 HTML 文件的基本路徑,可使文件內結依相對路徑 (relative path) 進行連結。



起始標籤結束標籤
需要不需要


<base /> 有兩個屬性 (attribute)
屬性
href基本路徑
target_self
_blank
_parent
_top


href 用來設定基本路徑,例如


http://www.w3.org/TR/html401/ 為 W3C 放置 HTML 4.01 標準的規格文件網址, <base /> 的 href 屬性設定為網頁的連結起始點,例如
<a href="intro/intro.html">
  2. Introduction to HTML 4</a>


點擊 2. Introduction to HTML 4 便會連結到



我們寫成一份完整的 HTML 文件如下
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
84
85
86
87
88
89
90
91
92
93
94
95
96
97
98
99
100
101
102
103
104
105
106
107
108
109
110
111
112
113
114
115
116
117
118
119
120
121
122
123
124
125
126
127
128
129
130
131
132
133
134
135
136
137
138
<html>
<head>
<title>HTML 4.01 參考文件</title>
</head>
<body>
<a href="">HTML 4.01 Specification</a>
<ul>
 <li>
  <a href="about.html">
  1. About the HTML 4 Specification</a>
 </li>
 <li>
  <a href="intro/intro.html">
  2. Introduction to HTML 4</a>
 </li>
 <li>
  <a href="sgmltut.html">
  3. On SGML and HTML</a>
 </li>
 <li>
  <a href="conform.html">
  4. Conformance: requirements and recommendations</a>
 </li>
 <li>
  <a href="charset.html">
  5. HTML Document Representation</a>
 </li>
 <li>
  <a href="types.html">
  6. Basic HTML data types</a>
 </li>
 <li>
  <a href="struct/global.html">
  7. The global structure of an HTML document</a>
 </li>
 <li>
  <a href="struct/dirlang.html">
  8. Language information and text direction</a>
 </li>
 <li>
  <a href="struct/text.html">
  9. Text</a>
 </li>
 <li>
  <a href="struct/lists.html">
  10. Lists</a>
 </li>
 <li>
  <a href="struct/tables.html">
  11. Tables</a>
 </li>
 <li>
  <a href="struct/links.html">
  12. Links</a>
 </li>
 <li>
  <a href="struct/objects.html">
  13. Objects, Images, and Applets</a>
 </li>
 <li>
  <a href="present/styles.html">
  14. Style Sheets</a>
 </li>
 <li>
  <a href="present/graphics.html">
  15. Alignment, font styles, and horizontal rules</a>
 </li>
 <li>
  <a href="present/frames.html">
  16. Frames</a>
 </li>
 <li>
  <a href="interact/forms.html">
  17. Forms</a>
 </li>
 <li>
  <a href="interact/scripts.html">
  18. Scripts</a>
 </li>
 <li>
  <a href="sgml/intro.html">
  19. SGML reference information for HTML</a>
 </li>
 <li>
  <a href="sgml/sgmldecl.html">
  20. SGML Declaration of HTML 4</a>
 </li>
 <li>
  <a href="sgml/dtd.html">
  21. Document Type Definition</a>
 </li>
 <li>
  <a href="sgml/loosedtd.html">
  22. Transitional Document Type Definition</a>
 </li>
 <li>
  <a href="sgml/framesetdtd.html">
  23. Frameset Document Type Definition</a>
 </li>
 <li>
  <a href="sgml/entities.html">
  24. Character entity references in HTML 4</a>
 </li>
 <li>
  <a href="appendix/changes.html">
  Appendix A: Changes</a>
 </li>
 <li>
  <a href="appendix/notes.html">
  Appendix B: Performance, Implementation, and Design Notes</a>
 </li>
 <li>
  <a href="references.html">
  References</a>
 </li>
 <li>
  <a href="index/elements.html">
  Index of Elements</a>
 </li>
 <li>
  <a href="index/attributes.html">
  Index of Attributes</a>
 </li>
 <li>
  <a href="index/list.html">
  Index</a>
 </li>
</ul>
</body>
</html>
 
<!-- 《程式語言教學誌》的範例程式
     檔名:example14.html
     功能:示範 HTML 標記語言的使用
     作者:張凱慶
     時間:西元 2010 年 11 月 -->


這份 HTML 文件以 http://www.w3.org/TR/html401/ 為基本路徑,所有超連結都是用相對路徑,簡單用瀏覽器 (broswer) 開啟如下



任點一個連結就會開啟 http://www.w3.org/TR/html401/ 的網頁



另一個屬性 target 為瀏覽器視窗開啟的模式,不做設定會在相同視窗中開啟,通常會做設定只會用到 _blank ,這具有新視窗或新分頁開啟的作用。


中英文術語對照
標籤tag
相對路徑relative path
屬性attribute
瀏覽器broswer


您可以繼續參考



相關目錄
HTML 4.01 快速導覽 - 目錄
HTML, CSS 教材
首頁


參考資料

沒有留言: