Please note, this is a STATIC archive of website developer.mozilla.org from 03 Nov 2016, cach3.com does not collect or store any user information, there is no "phishing" involved.

Revision 327257 of <basefont>

  • Revision slug: HTML/Element/basefont
  • Revision title: basefont
  • Revision id: 327257
  • Created:
  • Creator: ethertank
  • Is current revision? No
  • Comment HTML 5 > HTML5

Revision Content

{{obsolete_header}}

Summary

The HTML basefont element (<basefont>) establishes a default font size for a document. Font size then can be varied relative to the base font size using the {{HTMLElement("font")}} element.

Usage note:

Do not use this element! Though once (imprecisely) normalized in HTML 3.2, it wasn't supported in all major browsers. Further, browsers, and even successive versions of browsers, never implemented it in the same way: practically, using it has always brought indeterminate results.

The <basefont> element was deprecated in the standard at the same time as all elements related to styling only. Starting with HTML 4, HTML does not convey styling information anymore (outside the {{HTMLElement("style")}} element or the style attribute of each element). In HTML5, this element has been removed completely. For any new web development, styling should be written using CSS only.

The former behavior of the {{HTMLElement("font")}} element can be achieved, and even better controlled using the {{CSS_Reference:Fonts}} properties.

Attributes

Like all other HTML elements, this element supports the global attributes.

{{htmlattrdef("color")}}
This attribute sets the text color using either a named color or a color specified in the hexadecimal #RRGGBB format.
{{htmlattrdef("face")}}
This attribute contains a list of one or more font names. The document text in the default style is rendered in the first font face that the client's browser supports. If no font listed is installed on the local system, the browser typically defaults to the proportional or fixed-width font for that system.
{{htmlattrdef("size")}}
This attribute specifies the font size as either a numeric or relative value. Numeric values range from 1 to 7 with 1 being the smallest and 3 the default.

DOM interface

This element implements the HTMLBaseFontElement interface.

Example

<basefont color="#FF0000" face="Helvetica" size="+2" />

Compatibility

{{CompatibilityTable}}

Feature Chrome Firefox (Gecko) Internet Explorer Opera Safari
Basic support {{CompatUnknown}} {{CompatNo}} {{CompatVersionUnknown}} {{CompatNo}} {{CompatUnknown}}
Feature Android Firefox Mobile (Gecko) IE Mobile Opera Mobile Safari Mobile
Basic support {{CompatUnknown}} {{CompatNo}} {{CompatUnknown}} {{CompatNo}} {{CompatUnknown}}

Notes

  • HTML 3.2 supports the basefont element but only with the size attribute.
  • The strict HTML and XHTML specifications do not support this element.
  • Despite being part of transitional standards, some standards-focused browsers like Mozilla and Opera do not support this element.
  • This element can be imitated with a CSS rule on the {{HTMLElement("body")}} element.
  • XHTML 1.0 requires a trailing slash for this element: <basefont />.
{{HTML:Element_Navigation}}

Revision Source

<div>{{obsolete_header}}</div>
<h2 id="Summary">Summary</h2>
<p>The HTML basefont element (<code>&lt;basefont&gt;</code>) establishes a default font size for a document. Font size then can be varied relative to the base font size using the {{HTMLElement("font")}} element.</p>
<div class="note">
  <p><em>Usage note: </em></p>
  <p><strong>Do not use this element! </strong>Though once (imprecisely) normalized in HTML 3.2, it wasn't supported in all major browsers. Further, browsers, and even successive versions of browsers, never implemented it in the same way: practically, using it has always brought <em>indeterminate</em> results.</p>
  <p>The <code>&lt;basefont&gt; </code>element was deprecated in the standard at the same time as all elements related to styling only. Starting with HTML 4, HTML does not convey styling information anymore (outside the {{HTMLElement("style")}} element or the <strong>style</strong> attribute of each element). In HTML5, this element has been removed completely. For any new web development, styling should be written using <a href="/en-US/docs/CSS" title="CSS">CSS</a> only.</p>
  <p>The former behavior of the {{HTMLElement("font")}} element can be achieved, and even better controlled using the {{CSS_Reference:Fonts}} properties.</p>
</div>
<h2 id="Attributes">Attributes</h2>
<p>Like all other HTML elements, this element supports the <a href="/en-US/docs/HTML/Global_attributes" title="HTML/Global attributes">global attributes</a>.</p>
<dl>
  <dt>
    {{htmlattrdef("color")}}</dt>
  <dd>
    This attribute sets the text color using either a named color or a color specified in the hexadecimal #RRGGBB format.</dd>
  <dt>
    {{htmlattrdef("face")}}</dt>
  <dd>
    This attribute contains a list of one or more font names. The document text in the default style is rendered in the first font face that the client's browser supports. If no font listed is installed on the local system, the browser typically defaults to the proportional or fixed-width font for that system.</dd>
  <dt>
    {{htmlattrdef("size")}}</dt>
  <dd>
    This attribute specifies the font size as either a numeric or relative value. Numeric values range from 1 to 7 with 1 being the smallest and 3 the default.</dd>
</dl>
<h2 id="DOM_interface">DOM interface</h2>
<p>This element implements the <code><a href="/en-US/docs/DOM/HTMLBaseFontElement" title="DOM/HTMLBaseFontElement">HTMLBaseFontElement</a></code> interface.</p>
<h2 id="Example">Example</h2>
<pre>
&lt;basefont color="#FF0000" face="Helvetica" size="+2" /&gt;
</pre>
<h3 id="Compatibility">Compatibility</h3>
<p>{{CompatibilityTable}}</p>
<div id="compat-desktop">
  <table class="compat-table">
    <tbody>
      <tr>
        <th>Feature</th>
        <th>Chrome</th>
        <th>Firefox (Gecko)</th>
        <th>Internet Explorer</th>
        <th>Opera</th>
        <th>Safari</th>
      </tr>
      <tr>
        <td>Basic support</td>
        <td>{{CompatUnknown}}</td>
        <td>{{CompatNo}}</td>
        <td>{{CompatVersionUnknown}}</td>
        <td>{{CompatNo}}</td>
        <td>{{CompatUnknown}}</td>
      </tr>
    </tbody>
  </table>
</div>
<div id="compat-mobile">
  <table class="compat-table">
    <tbody>
      <tr>
        <th>Feature</th>
        <th>Android</th>
        <th>Firefox Mobile (Gecko)</th>
        <th>IE Mobile</th>
        <th>Opera Mobile</th>
        <th>Safari Mobile</th>
      </tr>
      <tr>
        <td>Basic support</td>
        <td>{{CompatUnknown}}</td>
        <td>{{CompatNo}}</td>
        <td>{{CompatUnknown}}</td>
        <td>{{CompatNo}}</td>
        <td>{{CompatUnknown}}</td>
      </tr>
    </tbody>
  </table>
</div>
<h2 id="Notes">Notes</h2>
<ul>
  <li>HTML 3.2 supports the basefont element but only with the size attribute.</li>
  <li>The strict HTML and XHTML specifications do not support this element.</li>
  <li>Despite being part of transitional standards, some standards-focused browsers like Mozilla and Opera do not support this element.</li>
  <li>This element can be imitated with a CSS rule on the {{HTMLElement("body")}} element.</li>
  <li>XHTML 1.0 requires a trailing slash for this element: <code>&lt;basefont /&gt;</code>.</li>
</ul>
<div>
  {{HTML:Element_Navigation}}</div>
Revert to this revision