Jump to content

Fonts different between text box and <textarea>


bulrush

Recommended Posts

I have a form that uses some text boxes (type="text") and some <textarea> boxes. The font in the text boxes appear to be Ariel, but the font in the <textarea> are always some type of Courier. How do I get the fonts to be all the same in all my controls in the form?

 

Here is some sample code I am using:

    $s='<tr><td>Product name: <td><input type="text" name="txtProdname" '.
       'id="txtProdname" value="'.$row['prodname'].'" size="50" maxlength="50" /></tr>';
    echo "$s\n";

    	$s='<tr valign="top"><td valign="top">Bullet: <td><textarea name="txtBullet[]" '.
    	   'id="txtBullet[]" rows="2" '.
    	   'cols="60" >'.$b.'</textarea> ';
    $s.='<input type="hidden" name="txtBullid[]" id="txtBullid[]" value="'.$bid.'" size="6" readonly />';
    $s.='</tr>';
    echo "$s\n";

 

Link to comment
Share on other sites

You can give the textarea a class in css to be able to change the font and size to what your other text is.

 

<textarea class="boxfix">...</textarea>

 

Make sure to change the font size to match your other text.

<style type="text/css">
boxfix { font-family: arial; font-size: 12pt; }
</style>

Link to comment
Share on other sites

It's not working. I have a file style.css which contains, among other things, this:

.inputfont {
font-family: arial;
font-size: 12pt;
}

 

I construct the <textarea> in my php file like this:

    while ($rowbull = mysqli_fetch_array($resbull)) 
	{
	$b=trim($rowbull['bullettext']);
	$bid=$rowbull['bullid'];
    	$s='<tr valign="top"><td valign="top">Bullet: <td><textarea name="txtBullet[]" '.
    	   'id="txtBullet[]" rows="2" '.
    	   'cols="60" class="inputfont" >'.$b.'</textarea> ';
    $s.='<input type="hidden" name="txtBullid[]" id="txtBullid[]" value="'.$bid.'" size="6" readonly />';
    $s.='</tr>';
    echo "$s\n";
    $oldbullarr[]=$b;
    $oldbidarr[]=$bid;
    $cnt++;
	} //while ($rowbull...

 

I tried spelling the font "Ariel" and "Arial". The font in the <textarea> didn't change. Does capitalization matter?

 

How can I find out the correct spellings (and capitalizations) of the fonts my browser (Firefox 3.6 on WinXP) uses?

Link to comment
Share on other sites

  • 1 year later...
This thread is more than a year old. Please don't revive it unless you have something important to add.

Join the conversation

You can post now and register later. If you have an account, sign in now to post with your account.

Guest
Reply to this topic...

×   Pasted as rich text.   Restore formatting

  Only 75 emoji are allowed.

×   Your link has been automatically embedded.   Display as a link instead

×   Your previous content has been restored.   Clear editor

×   You cannot paste images directly. Upload or insert images from URL.

×
×
  • Create New...

Important Information

We have placed cookies on your device to help make this website better. You can adjust your cookie settings, otherwise we'll assume you're okay to continue.