排版标记
;
1<p> ; <br/> ; <hr/> ; <center> ; <pre> ; <div> ; <nobr> ; <wbr/> ;
2---
3|
4
5■ <!--注解-->:
6
7|
8
9▲Top
10
11---|---
12像很多电脑语言一样,HTML 文件亦提供注解功能。浏览器会忽略此标记中的文字(可以 是很多行)而不作显示,一般使用目的:
13
14 * 为文中不同部份加上说明,方便日后修改。
15这对较复杂或非私人网页尤其重要,它不单是提醒自已,亦提醒你的同事这部分 做什么、那部分做什么。
16例子:
17<!--由这处开始是产品订购表格-->
18
19 * 用作版权声明。
20假如你不希望别人使用或复制你的网页,可加上警告字眼。
21例子:
22<!--本文版权为 1998, Creation of Webpage 所拥有,未经许,请勿抄摘-->
23
24
25|
26
27■ <p> :
28
29|
30
31▲Top
32
33---|---
34<p>称为段落标记。作用:为字、画、表格等之间留一空白行。
35
36本来<p>是一围堵标记,标于一段落的头尾,但从 HTML 2.0 开始己不需要</p>作结尾。
37
38<p> 的常用参数: 如:<p align="center">
39
40 * align="center"
41可选值:right, left, center。
42内定值: align="left"
43
44
45
46例子: | 原始码 | Here is the text for my paragraph. It does't matter how long it is,
47how many space are between the words or when I decide to hit the return key.
48It will create a new paragraph only when I begin the tag with another one.
49<p>Here's the next paragraph.
50---|---
51显示结果 |
52
53Here is the text for my paragraph. It does't matter how long it is, how many space are between the words or when I decide to hit the return key. It will create a new paragraph only when I begin the tag with another one.
54
55Here's the next paragraph.
56
57|
58
59■ <br/> :
60
61|
62
63▲Top
64
65---|---
66<br/>称为换行标记。作用:令字、画、表格等显示于下一行。
67
68由于浏览器会自动忽略原始码中空白和换行的部分,这令到<br/>成为最常用的标记之 一。因为无论你在原始码中编好了多漂亮的文章,若不适当地加上换行标记或段落标记, 浏览器只会将它显示成一大段。
69
70错误示范:(邮局可不会接受一行过的地址) | 原始码 | 566 E Boston Post RD
71Mamaroneck NY 10543-9982
72United States of America
73---|---
74结果 | 566 E Boston Post RD Mamaroneck NY 10543-9982 United States of America
75
76正确例子: 原始码 | 566 E Boston Post RD
77<br/>Mamaroneck NY 10543-9982
78<br/>United States of America
79---|---
80结果 | 566 E Boston Post RD
81Mamaroneck NY 10543-9982
82United States of America
83
84|
85
86■ <hr/> :
87
88|
89
90▲Top
91
92---|---
93<hr/>称为水平线。作用:插入一条水平线。
94
95<hr/> 之参数修改:
96以: <hr align="LEFT" color="#0000FF" noshade="" size="2" width="70%"/> 为例。
97
98 * align="LEFT"
99设定线条置放位置,可选择:left;right;center 三种设定值。
100
101 * size="2"
102设定线条厚度,以像素作单位,内定为 2。
103
104 * width="70%"
105设定线条长度,可以是绝对值(以像素作单位)或相对值,内定为 100%。
106
107 * color="#0000FF" 『只适用于IE』
108设定线条颜色,内定为黑色。 #0000FF 代表蓝色,亦可以采用颜色的名称,即 text="blue" 。
109
110 * noshade
111设定线条为平面显示,若删去则具阴影或立体,这是内定值。
112
113
114
115例子: | 原始码 | <hr/>
116<hr align="LEFT" size="4"/>
117<hr align="LEFT" color="#0000FF" noshade="" size="2" width="70%"/>
118<hr align="LEFT" color="#008000" size="4" width="70"/>
119---|---
120显示结果 |
121
122* * *
123
124* * *
125
126* * *
127
128* * *
129
130|
131
132■ <center> :
133
134|
135
136▲Top
137
138---|---
139<center>称为居中标记。作用:令字、画、表格等显示于中间。
140
141这标记原先是 Netscape 所定义,后来其它浏览器都支持它,但你会发现很多标记已有 align="CENTER" 的参数,<center>似乎多馀了,事实上它还是常用的标记之一,其简单 易用,常用于文字上,对于己加有 align="CENTER" 参数的 <table> 标记亦要不厌其烦 地加上居中标记,因有狻多浏览器不支持<table> 标记中的 align="CENTER" 参数。
142
143例子: | 原始码 | <center>Chris's First Homepage</center>
144<center>What's new</center>
145<center>My profile</center>
146---|---
147结果 | Chris's First Homepage What's new My profile
148
149|
150
151■ <pre> :
152
153|
154
155▲Top
156
157---|---
158<pre>称为预设格式标记。作用:令文件按照原始码的排列方式显示。
159
160这标记允许保留你于原始码中输入的空白及 Return。细看以下例子你便可体会到此标记的 威力。除了运用一大堆表格标记之外你只有采用这标记才能有此效果。
161
162能以<pre>标记产生对 效果,或产生多于一行的空白才算上乘!
163
164例子: | 原始码 |
165
166
167 <pre> Creation of Webpage Log Analysis I
168
169 Composer Learning 459 407 480 522 547 586 673
170 HTML Advanced 200 268 296 358 385 453 506</pre>
171
172---|---
173显示结果 |
174
175
176 Creation of Webpage Log Analysis I
177
178 Composer Learning 459 407 480 522 547 586 673
179 HTML Advanced 200 268 296 358 385 453 506
180
181|
182
183■ <div> :
184
185|
186
187▲Top
188
189---|---
190<div>称为区隔标记。作用:设定字、画、表格等的摆放位置。
191
192<div>应用于 Style Sheet(式样表)方面会更显威力,它最终目的是给设计者另一种组织 能力,有 Class ; Style ; title ; ID 等属性,将会于【Style Sheet】一节才作详述,这处只介绍 一个属性设定。
193以 <div align="center"> 为例:
194
195 * align="center"
196可选值:center ; left ; right 。决定字、画、表格等居中、靠左或靠右。
197<div align="center"> 的作用和居中标记 <center>一样,前者是由 HTML3.0 开始 的标准,后者是通用己久的标示法。
198
199
200
201
202例子: | 原始码 | <div align="center">Chris's First Homepage
203<br/>What's new
204<br/>My profile</div>
205---|---
206结果 |
207
208Chris's First Homepage
209What's new
210My profile
211
212|
213
214■ <nobr> :
215
216|
217
218▲Top
219
220---|---
221<nobr>称为不折行标记。作用:令某些文字不因太长而绕行,一 显示于同一行或下一 行。它对住址、数学算式、一行数字、程式码等尤为有用。
222
223例子:(其中 Chris's Creation of Webpage 将不被分开而显示于同一行。) | 码 | If you want to know how to create you own homepage quickly, don't miss <nobr>Chris's Creation of Webpage</nobr> which will help you a lot.
224---|---
225结果 | If you want to know how to create you own homepage quickly, don't miss Chris's Creation of Webpage which will help you a lot.
226
227|
228
229■ <wbr/> :
230
231|
232
233▲Top
234
235---|---
236<wbr/>称为建议折行标记。作用:预设折行部位。
237它没有侵犯到 <br/> 的责任,只是作建议而已,若观者的系统解像度够高的话,那么它是 不会折行的。
238
239例子:(若不加<wbr/>标记,整个网址会显示于下一行。) | 原始码 | Please visit my other homepage which locate at http://www.geocities.com/SiliconValley/<wbr/>Sector/8234/index.html There are many softwares for download. I think you will really love that place.
240---|---
241结果 | Please visit my other homepage which locate at http://www.geocities.com/SiliconValley/ Sector/8234/index.html There are many softwares for download. I think you will really love that place.</nobr></nobr></center></div></div></div></div></div></pre></pre></pre></table></table></center></center></center></p></p></p></p></p></nobr></div></pre></center></p>