Tek-Tips is the largest IT community on the Internet today!

Members share and learn making Tek-Tips Forums the best source of peer-reviewed technical information on the Internet!

  • Congratulations gkittelson on being selected by the Tek-Tips community for having the most helpful posts in the forums last week. Way to Go!

Base font not working 1

Status
Not open for further replies.

developer155

Programmer
Jan 21, 2004
512
US
I am setting a base font in the beggining of my HTML doc like this

<HTML><HEAD><TITLE>This is Title</TITLE></HEAD>
<BASEFONT SIZE=1>

and then later in the document I set the size of heading to be 3 but when I print the document the text is actually bigger then the headings for some reason, basefont does nto seem to be changing the size of text, while headings work fine with <font> tags. What could be the problem?

thanks!
 
The BASEFONT element, deprecated in HTML 4.0 in favor of style sheets, allows authors to suggest rudimentary font changes. Use of the BASEFONT element brings the same usability and accessibility problems as FONT?

Unlike FONT, BASEFONT's changes affect the base font, and so apply to all content following the BASEFONT element except for headings. However, most browsers fail to apply changes in the base font size and color to TABLEs.

BASEFONT's required SIZE attribute specifies the font size to use on a browser-dependent scale of 1 to 7, with the default being 3.

The poorly supported COLOR and FACE attributes suggest a font color and face, respectively. Style sheets are better supported and more flexible than BASEFONT's COLOR and FACE attributes.
As you can see, the basefont tag is deprecated and poorly supported. I would suggest you take a look at the CSS, a good reference can be found at W3Schools. For your example, you would define the font size for your body tag (every element inside body tag should adopt the setting)
Code:
<style type="text/css">
 body {
  font-size: 0.8em;
 }
</style>
Put the code in the <head> section of your document.
 
OK, I put this line in
<HTML><HEAD><TITLE> Community Overview</TITLE><style> body {font-size: 8pt;}</style></HEAD><BODY>

and no result. Is there somethig else I need? Another thing is that inside the body I have headings for which I separately specify the size with FONT SIZE tags

thanks!!!
 
A star for Vragabond's post. With CSS, you should strip away each and every <FONT> tag in your document. This will allow you to make adjustments to all your elements from the CSS, for example to change <H1> font size:
Code:
h1 { font-size: 18pt; }
Hope this helps.

News and views of some obscure guy
 
Another thing, if I remember correctly, if you don't have a doctype declaration it may cause your browser to jump to "quirks mode" and cause CSS font size settings to be ignored within table cells. The doctype goes before anything else in the code:
Code:
<!DOCTYPE HTML PUBLIC "-//W3C//DTD HTML 4.01 Transitional//EN" "[URL unfurl="true"]http://www.w3.org/TR/html4/loose.dtd">[/URL]

News and views of some obscure guy
 
Status
Not open for further replies.

Part and Inventory Search

Sponsor

Back
Top