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 IamaSherpa on being selected by the Tek-Tips community for having the most helpful posts in the forums last week. Way to Go!

correct font size

Status
Not open for further replies.

taval

Programmer
Jul 19, 2000
192
GB
Currently I'am using these sort of tags to display my text on html pages:

<font face=&quot;Arial,Helvetica&quot;><font size=-1>I'm currently a student at City University reading a B.Eng in Computing. My favourite sports include</font></font>

I think using font size=-1 creates a different font size depending on the browsers text size defaults. I was wondering if there was a way I can set the font size to a standard 10pt or 12pt so that the font will be the same size in all browsers?

Grateful for any help, Thanks. [sig][/sig]
 
The point is that by specifying 'size = -1' then the font that displays is relative to the default for the browser (also you only need one <font> tag as well).
There are two ways round this, EITHER:-

<font face=&quot;Arial,Helvetica&quot; size=n>your text</font>,
where n = 1 to 7 (2 or 3 are usually used),

OR:-

<font face=&quot;Arial,Helvetica&quot; size=&quot;10pt&quot;>your text</font>,
where you can specify the exact point size required.

The second option can also be done using css entries with, for example :-

{font-size: 10pt; font-weight: normal; font-family: Arial; color:#000000;}

Hope this is of some help :) [sig][/sig]
 
I've tried using this

<font face=&quot;Arial,Helvetica&quot; size=7>your text</font>

method but still the text size becomes becomes bigger on some of the computers at Uni and I have to set the text size so it looks normal. How do other web sites keep there fonts looking the same on all/most browsers?

I've even tried
<font face=&quot;Arial,Helvetica&quot; size=&quot;10pt&quot;>sports include</font>

but the text this time is big and not 10pt. Is something wrong here, need help.




 
most sites use cascading style sheets to specify fonts by creating classes for the span tag.

You can find more information at on cascading style sheets. I try to stay away from assigning sizes because everyone has their browser set differently. The only time I assign sizes are for headers.

You could have a style sheet that reads something like below:

BODY {
font-family: Verdana,Tahoma,Arial,Helvetica,sans-serif;
font-size: xx-small;}
H2 {
color: Navy;
font-family: Verdana, Tahoma, Arial, Helvetica, sans-serif; font-size: medium; font-weight: bold; text-align: center;}

The items below are classes and would be called in the HTML code as such: <span class=&quot;defaulttext&quot;>text here</span>

<!-- All of the links and text in the tables
-->
.defaulttext {
color : white;
font-size : 12pt;
font-weight : bold;
}

<!-- The color of the warning text
-->
.warning {
color : #FF0000;
font-size : 12pt;
font-weight : bold;
}

<!-- Link report fonts
-->
.reports {
font-size : 10pt;
font-weight : bold;
}

<!-- Image Catalog text
-->
.imagetext {
font-color : black;
font-size : 10pt;
}

I do prefer using point sizes because both browsers will recoginze them when I use them. Also, as I said above, some people have their browsers using their default fonts and sizes so it's real hard - you have to look at it on several different machines. Try the one's and UNI and then maybe a public library or something.

Hope this helped
[sig][/sig]
 
Status
Not open for further replies.

Part and Inventory Search

Sponsor

Back
Top