Netscape 1.0 (and above) and Microsoft's Internet Explorer support different sized fonts within HTML documents. This should be distinguished from Headings.
The element is <FONT SIZE=value>
. Valid values range from 1-7. The default FONT
size is 3. The value given to size can optionally have a '+' or '-' character in front of it to specify that it is relative to the document BASEFONT
. The default BASEFONT
is 3, and can be changed with the <BASEFONT SIZE ...>
element.
<FONT SIZE=4>changes the font size to 4</FONT>
<FONT SIZE=+2>changes the font size to BASEFONT SIZE ... +2</FONT>
Internet Explorer and Netscape support the ability to change the font colour as well as face type. They use COLOR and FACE attributes to the <FONT>
element.
COLOR = #rrggbb or COLOR = color
The colour attribute sets the colour which text will appear in on the screen. #rrggbb is a hexadecimal colour denoting a RGB colour value. Alternately, the colour can be set to one the available pre-defined colours (see <BODY BGCOLOR=...>
). These colour names can be used for the BGCOLOR, TEXT, LINK,
and VLINK
attributes of the <BODY>
element as well. NOTE : The use of names for colouring text is currently only supported by the Internet Explorer and Netscape. Also, it should be noted that HTML attributes of this kind (that format the presentation of the content) can also be controlled via the use of style sheets.
Example:
<FONT COLOR="#FF0000">This text is red.</FONT>
or
<FONT COLOR="Red">This text is also red.</FONT>
would render as :
This text is red
FACE=name [,name] [,name]
The FACE
attribute sets the typeface that will be used to display the text on the screen. The type face displayed must already be installed on the users computer. Substitute type faces can be specified in case the chosen type face is not installed on the customers computer. If no match is found, the text will be displayed in the default type that the browser uses for displaying 'normal' text.
Example:
<FONT FACE="Courier New, Comic Sans MS"> This text will be displayed in either Courier New, or Comic Sans MS, depending on which fonts are installed on the browsers system.
</FONT>
NOTE : When using this element, care should be taken to try to use font types that will be installed on the users computer if you want the text to appear as desired. Changing the font face is only supported by Netscape and Internet Explorer, while Internet Explorer can also set font sizes/colours/faces within a style sheet. Also note that in a document whose layout/colouring etc., is defined in a style sheet, using the <FONT>
element will have no effect.
TITLE="informational ToolTip"
The Internet Explorer 4.0 (and above) specific TITLE
attribute is used for informational purposes. If present, the value of the TITLE
attribute is presented as a ToolTip when the users mouse hovers over the <FONT>
section.
LANG="language setting"
The LANG
attribute can be used to specify what language the <FONT>
element is using. It accepts any valid ISO standard language abbreviation (for example "en"
for English, "de"
for German etc.) For more details, see the Document Localisation section for more details.
LANGUAGE="Scripting language"
The LANGUAGE
attribute can be used to expressly specify which scripting language Internet Explorer 4.0 uses to interpret any scripting information used in the <FONT>
element. It can accept values of vbscript
, vbs
, javascript
or jscript
. The first two specify the scripting language as Visual Basic Script, the latter two specify it as using Javascript (the default scripting language used if no LANGUAGE
attribute is set.
CLASS="Style Sheet class name"
The CLASS
attribute is used to specify the <FONT>
element as using a particular style sheet class. See the Style Sheets topic for details.
STYLE="In line style setting"
As well as using previously defined style sheet settings, the <FONT>
element can have in-line stylings attached to it. See the Style Sheets topic for details.
ID="Unique element identifier"
The ID
attribute can be used to either reference a unique style sheet identifier, or to provide a unique name for the <FONT>
element for scripting purposes. Any <FONT>
element with an ID
attribute can be directly manipulated in script by referencing its ID
attribute, rather than working through the All collection to determine the element. See the Scripting introduction topic for more information.
POINT-SIZE="Font pt. size"
The POINT-SIZE
attribute is Netscape specific and allows total sizing control over the contents of the element. For example:
<FONT POINT-SIZE="24">This is 24pt. font</FONT>
Note that Internet Explorer supports font sizings primarily through Style Sheets (as does Netscape 4.0).
WEIGHT
This Netscape specific <FONT>
attribute can be used to specify a relative font weight (boldness). It accepts values ranging between 100 and 900 (in steps of 100 - i.e. 100, 200, 300 etc.) It allows finer control of the font's boldness, rather than using <B>
, <STRONG>
, or the font-weight
style sheet attribute.
Every <FONT>
element in a document is an object that can be manipulated through scripting. Note that scripting of the <FONT>
element/object is only supported by Internet Explorer 4.0 in its Dynamic HTML object model. Netscape does not support direct scripting of the <FONT>
element at all.
<FONT...>
Properties
The <FONT...>
element/object supports all of the standard Dynamic HTML properties (i.e. className, document, id, innerHTML, innerText, isTextEdit, lang, language, offsetHeight, offsetLeft, offsetParent, offsetTop, offsetWidth, outerHTML, outerText, parentElement, parentTextEdit, sourceIndex, style, tagName and title). Details of these can be found in the standard Dynamic HTML properties topics.
In addition, the <FONT>
element also supports the color, face and size properties, which directly reflect their attribute settings (see above).
<FONT...>
Methods
The <FONT...>
element/object supports all of the standard Dynamic HTML methods (i.e. click, contains, getAttribute, insertAdjacentHTML, insertAdjacentText, removeAttribute, scrollIntoView and setAttribute). Details of these can be found in the standard Dynamic HTML Methods topics.
<FONT...>
Events
The <FONT...>
element/object supports all of the standard Dynamic HTML events (i.e. onclick, ondblclick, ondragstart, onfilterchange, onhelp, onkeydown, onkeypress, onkeyup, onmousedown, onmousemove, onmouseout, onmouseover, onmouseup and onselectstart). Details of these can be found in the standard Dynamic HTML events topics.
© 1995-1998, Stephen Le Hunte
file: /Techref/language/html/ib/Text_Formatting/font.htm, 12KB, , updated: 2004/3/1 15:47, local time: 2024/12/25 12:59,
3.137.175.166:LOG IN
|
©2024 These pages are served without commercial sponsorship. (No popup ads, etc...).Bandwidth abuse increases hosting cost forcing sponsorship or shutdown. This server aggressively defends against automated copying for any reason including offline viewing, duplication, etc... Please respect this requirement and DO NOT RIP THIS SITE. Questions? <A HREF="http://techref.massmind.org/techref/language/html/ib/Text_Formatting/font.htm"> <FONT></A> |
Did you find what you needed? |
Welcome to massmind.org! |
Welcome to techref.massmind.org! |
.