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!

Font size will not change for font-family: courier

Status
Not open for further replies.

NeeNee

Programmer
Apr 2, 2002
97
CA
I have a table where I set the font-family to courier and a set style for a cell to display the time.

Table {
font-size: 12px;
font-family: courier;
}

.Time{font-size: x-small;
background-color:#e6e6e6;
text-align: center;
font-weight: bold
}

The problem is I need equal letter spacing on the web page so I used the courier font but the font size will not change when I assing the .time class to a <td>. If I change the font to arial or times, the font size does change.
Does anyone know a fix for this or a different font I could use.

Denis
Programmer Canada
 
This works ok for me:
Code:
<style type="text/css">
Table {
    font-size: 12px; 
    font-family: monospace;
}

.Time{
   font-size: x-small; 
   background-color:#e6e6e6; 
   text-align: center; 
   font-weight: bold 
}
</style>

<table>
  <tr>
     <td class="Time">12:35</td>
  </tr>
</table>
It worked with Courier as well, but courier is proprietary font name and it is possible that it is not available on all computers. Monospace is a generic font type that will select any equal letter spacing font installed on the computer. Hope it helps.
 
On my PC "courier" is a fixed-size bitmap font, maybe your browser objects to resizing it. "Courier New", by contrast, is a TrueType font and can be resized freely (though it does become illegible at smaller sizes). So if you want to ensure a courier-style font, try this:
Code:
    font-family: "Courier New", Courier, monospace;
Windows users will get Courier New, Mac users will get Courier, anybody else (who doesn't have either font) gets the generic monospace font.

Incidentally, many (if not most) fonts are designed such that digits have equal width. So you can probably use the same font as the rest of the page without any adverse effect.



-- Chris Hunt
 
Thank you for your help.
I tried Courier New and it now works fine.

 
Status
Not open for further replies.

Part and Inventory Search

Sponsor

Back
Top