blob: d8a988588cba1f3577f7bbad3bcd15549e93b8c7 (
plain)
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
|
---
title: <font>
slug: Web/HTML/Element/font
translation_of: Web/HTML/Element/font
---
<div>{{obsolete_header}}</div>
<h2 id="概要">概要</h2>
<p><em>HTML Font 元素</em>(<code><font></code>)定義了該內容的字體大小、顏色與表現。</p>
<div class="note">
<p><em>注意:</em></p>
<p><strong>不要使用這個元素!</strong>儘管它在 HTML 3.2 規範化,但在 HTML 4.01,因為該元件只有裝飾用途的理由而遭棄用,接著在 HTML5 廢棄。</p>
<p>從 HTML 4 開始,HTML 不能在 {{HTMLElement("style")}} 元素,或各元素 <strong>style</strong> 屬性以外,表現任何樣式資訊。今後的網頁開發,樣式化要用 <a href="/zh-TW/docs/CSS" title="CSS">CSS</a>。</p>
<p>{{HTMLElement("font")}} 元素的行為,能透過 <a href="/zh-TW/docs/CSS" title="CSS">CSS</a> 屬性實現,也更好控制。</p>
</div>
<h2 id="屬性">屬性</h2>
<p>如同其他 HTML 元素,這個元素支援<a href="/en-US/docs/HTML/Global_attributes" title="HTML/Global attributes">全域屬性</a>。</p>
<dl>
<dt>{{htmlattrdef("color")}}</dt>
<dd>這個屬性可以藉由顏色名字或是十六進位的 #RRGGBB 格式,來配置文字的顏色。</dd>
<dt>{{htmlattrdef("face")}}</dt>
<dd>這個屬性列出了一個或多個逗號分隔的字體名稱。 The document text in the default style is rendered in the first font face that the client's browser supports. 如果在用戶端的系統並沒有安裝這個字體,瀏覽器會在該系統使用預設的 proportional 或是 fixed-width 字體。</dd>
<dt>{{htmlattrdef("size")}}</dt>
<dd>這個屬性藉由數字或相對值指定文字大小。數字是由最小的 <code>1</code> 到最大的 <code>7</code> 之間,且預設為 <code>3</code> 的數值表示。也可以用諸如 <code>+2</code> 或 <code>-3</code> 的相對值指定, which set it relative to the value of the {{htmlattrxref("size", "basefont")}} attribute of the {{HTMLElement("basefont")}} element, or relative to <span style="font-family: courier new;">3</span>, the default value, if none does exist.</dd>
</dl>
<h2 id="DOM_介面">DOM 介面</h2>
<p>這個元素 implements {{domxref("HTMLFontElement")}} 介面。</p>
<h2 id="瀏覽器相容性">瀏覽器相容性</h2>
<p>{{Compat("html.elements.font")}}</p>
<div>{{HTMLRef}}</div>
|