You are here: Reference > JavaScript > client-side > HTML DOM > objects > nodes and tags > basefont

basefont object

Browser support:
Specifies a default font value for the document.
This tag is deprecated. If you want to define how text should basically be shown in the document, use style properties for the body tag.

Syntax:

Methods that return the object:
document.createElement ("basefont")
The base interface, through which you can add new functionalities to the baseFont object, is the HTMLBaseFontElement interface.
If you want to see the HTML objects by categories, please visit this page.
HTML page for this element: basefont

Possible members:

Properties
Methods
Events
Style properties
attributes
Represents a collection of attribute nodes that belong to an element.
behaviorUrns
Represents a collection of the Uniform Resource Names for all behaviors attached to an element.
canHaveChildren
Retrieves a Boolean value that indicates whether the element can contain child elements.
canHaveHTML
Retrieves a Boolean value that indicates whether the element can contain HTML formatted text.
className
Sets or retrieves the style class or classes that belong to the element.
color
Sets or retrieves the color of the text or line.
currentStyle
Represents the computed style settings for an element.
dir
Sets or retrieves the text direction as related to the lang property.
disabled
Sets or retrieves the state of an object for user interaction.
face
Specifies or returns the font face for a page or for a font element.
id
Sets or retrieves a unique identifier for the object.
isContentEditable
Returns a Boolean value that indicates whether the contents of the object are editable by the user.
isDisabled
Returns a Boolean value that indicates whether the object is disabled.
isMultiLine
Returns a Boolean value that indicates whether the contents of an element can be multiline or not.
isTextEdit
Returns a Boolean value that indicates whether the createTextRange method can be used for the element.
lang
Specifies or returns the language of the element.
localName
9
Returns the local part of the qualified name of the current node.
namespaceURI
9
Sets or returns the namespace URI of the current node.
nextElementSibling
9
Returns a reference to the next child element of the current element's parent.
nextSibling
Returns a reference to the next child of the current element's parent.
nodeName
Returns the name of the current node.
nodeType
Returns an integer that indicates the type of the node.
nodeValue
Sets or returns the value of the current node.
outerHTML
Sets or retrieves the outer HTML content (the source code including the opening and closing tags) of an element.
outerText
Sets or returns the text content of an element including the text content of its descendants.
ownerDocument
Returns the document object that contains the current node.
parentElement
Returns the parent element of the object in the DOM hierarchy.
parentNode
Returns the parent element of the current node in the DOM hierarchy.
parentTextEdit
Returns the closest ancestor element of the current element in the DOM hierarchy that can be used to create a TextRange object.
previousElementSibling
9
Returns a reference to the previous child element of the current element's parent.
previousSibling
Returns a reference to the previous node of the current element's parent.
readyState
Returns a string value that represents the state of the object.
runtimeStyle
Represents the overridden style settings for an element.
scopeName
Retrieves the local name of the namespace declared for the current element.
size
Specifies or returns the size of the font.
sourceIndex
Returns the position of the current object in the all collection of the document.
style
Represents the inline style settings for an element or a CSS rule.
tagName
Returns the tag name of the current element.
tagUrn
Sets or retrieves the Uniform Resource Name (URN) of the namespace declared for the current element.
uniqueID
Returns the unique identifier generated by the browser for the object.

Example HTML code 1:

This example illustrates the use of the baseFont element:
<basefont size="7" /> Set the BASEFONT size.
<font size="4">Font size=4.</font>
Resume the BASEFONT size.
<basefont size="3" />
All text size = 3 in the future
Did you find this example helpful? yes no

Example HTML code 2:

Recommendation:
<head>
    <style>
        body {
            font-size: 13px;
            color: #120811;
            font-weight:bold;
        }
    </style>
</head>
<body>
    Some text content
</body>
Did you find this example helpful? yes no

Example HTML code 3:

This example shows how to get the default font size specified by a baseFont element:
<head>
    <script type="text/javascript">
        function GetBaseFontSize () {
            var baseFont = document.getElementById ("myBaseFont");
            alert (baseFont.size);

            if (baseFont.currentStyle) {
                alert ("It means " + baseFont.currentStyle.fontSize);
            }
        }
    </script>
</head>
<body>
    <basefont id="myBaseFont" size="7" /> 
        The default font size of 7.
    <button onclick="GetBaseFontSize ()">Get the default font size</button>
</body>
Did you find this example helpful? yes no

Related pages:

External links:

User Contributed Comments

Post Content

Post Content