Monospace font problem

JavaScript and client side scripting.

Moderator: General Moderators

Post Reply
paultfh
Forum Commoner
Posts: 31
Joined: Thu Jul 20, 2006 6:24 pm

Monospace font problem

Post by paultfh »

I am outputting data to a table and I need each character to be the same widrh.
I can't find a monospace font that works.

My style:

Code: Select all

tr.monotext {
font-family: "Courier New", Courier, monospace;
}
Strings with capital letters end up being longer than comparable strings with lower case.
Am I missing something?
User avatar
feyd
Neighborhood Spidermoddy
Posts: 31559
Joined: Mon Mar 29, 2004 3:24 pm
Location: Bothell, Washington, USA

Post by feyd »

table rows don't have text. :P
paultfh
Forum Commoner
Posts: 31
Joined: Thu Jul 20, 2006 6:24 pm

Post by paultfh »

Hmmm. It has been changing the text when I enter different fonts in there.

Changed to td and switched them to the cells. Same output, same problem.
paultfh
Forum Commoner
Posts: 31
Joined: Thu Jul 20, 2006 6:24 pm

Post by paultfh »

Code: Select all

<style type="text/css">
body {
  	background: none;
}

td.monotext {
	font-family: 	font-family: "Courier New", Courier, monospace;
}
</style>

Code: Select all

<td class=\"monotext\" align=left>{$number}</td>
<td class=\"monotext\">".$arr['nzbID']."</td>
<td class=\"monotext\">". $nzb->truncate_string($arr['name'],50) . "</td>
<td class=\"monotext\">" . $arr['groupname'] . "</td>
<td class=\"monotext\" align=center>".$age."</td>
<td class=\"monotext\" align=right>".$arr['numfiles']."</td>
<td class=\"monotext\" align=right>" . $nzb->readablesize($arr['size']) . "</td>
User avatar
Benjamin
Site Administrator
Posts: 6935
Joined: Sun May 19, 2002 10:24 pm

Post by Benjamin »

I believe text inside of <pre> tags is monospace, and you can set the size with css.
User avatar
daedalus__
DevNet Resident
Posts: 1925
Joined: Thu Feb 09, 2006 4:52 pm

Post by daedalus__ »

uh

Code: Select all

td.monotext { 
        font-family:    font-family: "Courier New", Courier, monospace; 
}
paultfh
Forum Commoner
Posts: 31
Joined: Thu Jul 20, 2006 6:24 pm

Post by paultfh »

Daedalus- wrote:uh

Code: Select all

td.monotext { 
        font-family:    font-family: "Courier New", Courier, monospace; 
}
Sorry, copy paste problem.
User avatar
pickle
Briney Mod
Posts: 6445
Joined: Mon Jan 19, 2004 6:11 pm
Location: 53.01N x 112.48W
Contact:

Post by pickle »

This is a long shot - but do you have Courier New or Courier installed. 100% of systems I've been on do, but you never know...
Real programmers don't comment their code. If it was hard to write, it should be hard to understand.
paultfh
Forum Commoner
Posts: 31
Joined: Thu Jul 20, 2006 6:24 pm

Post by paultfh »

Yup, they're installed.
paultfh
Forum Commoner
Posts: 31
Joined: Thu Jul 20, 2006 6:24 pm

Post by paultfh »

astions wrote:I believe text inside of <pre> tags is monospace, and you can set the size with css.
That worked, thanks.
Post Reply