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
https://forums.phpfreaks.com/topic/209799-fonts-different-between-text-box-and/
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>

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?

  • 1 year later...

Bulrush,

 

This is a v late reply and I suspect you will have resolved your <textarea> font issues however I read your post and the simple answer to fix this is below.  Hope this helps you and anyone else who sees this post.

 

http://jsfiddle.net/audetwebdesign/gakfk/

Archived

This topic is now archived and is closed to further replies.

×
×
  • 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.