Is there a way to make some text unresizable?
For example: the text doesn't get bigger or smaller when someone hit view > text size > (text size).
Unfortunately, I am limited to CSS, HTML, and javascript. (However, I try to minimize the use of javascript. The JS content is blocked when I open the files on my own computer. I fear that other users won't be able to view the page when I put the files on the server.) Any suggestions?
Resizable font destroy the positioning of the blocks and images...
Try a php-script that creates an image, and puts some text on it.
If the user don't uses the imageresize addon of firefox (I don't if other browsers have something like that), the text will always have the same size.
Hey,
You can use the font tag in the HTML.
there you can fix the size, i think it won't resize the font size.
Otherwise TomS idea is good...
Firefox can resize the font, even it is was declared with the font tags.
I don't know about other browsers.
Code for GIF (not animated)
| Code: |
<?php
$bild = "empty.gif"; #You need an emtpy GIF-image
$im = imagecreatefromgif($bild);
// Enter textcolor in RGB
$text_color = ImageColorAllocate ($im, 229, 0, 123);
// Enter the text.
$text = "Bla bla bla bla";
// Textsize and position
imageString($im, 2, 3, 16, $text, $text_color);
header("Content-Type: image/gif");
imagegif($im,'',100);
imagedestroy ($im);
?> |
Code for JPEG
| Code: |
<?php
$bild = "empty.jpg"; #You need an emtpy JPEG-image
$im = imagecreatefromjpeg($bild);
// Enter textcolor in RGB
$text_color = ImageColorAllocate ($im, 229, 0, 123);
// Enter the text.
$text = "Bla bla bla bla";
// Textsize and position
imageString($im, 2, 3, 16, $text, $text_color);
header("Content-Type: image/jpeg");
imagejpeg($im,'',100);
imagedestroy ($im);
?> |
Note: this is a very simple code. The text can't contain linebreaks.
If you really need a new line, copy $text=""; to $text2="";
and copy "imageString($im, 2, 3, 16, $text, $text_color);"
to "imageString($im, 20, 3, 16, $text2, $text_color);"
replace 20 with another number, until the space between lines fits your imagination.
IMHO, you shouldn't avoid people to resize their font sizes... accessibility stuff ... supposing that i have some kind of visual problems and have to enlarge the font size to read your site, and if you lock this feature, I can't go further reading and you will lose 1 visitor... (ok, that's only one and others with visual problems, but I hope you don't think like that
)
With a font tag, the users can still resize the text.
PHP is not an alternative solution for me here since the server has never installed any other languages other than the standards. Anything on my computer that can't be viewed with just a "Open File" can not be viewed on the server. I had installed PHP and mySQL on my computer, but I will not do the same for the server. I am not an expert in the field of networking. If the server crashes and I do not know how to fix it, I am in deep trouble.
I am limited to CSS, HTML, and javascript (unless there are others that I didn't know of).
Creating images [with adobe or something... (that is not a script?)] does work, but it is a pain when if I decided to redo the layout than it is just editing the text. (Creating images (with adobe, etc.) in a substition to a text... just doesn't seem right to me.) I like to do programs in a dynamical way (for example: making 10 textboxes when the client only needed 3 or 900), reusability, etc...
If there isn't a solution to this, I will just try to program it myself with javascript.
I agree with mariohs. There is no good reason why you should want to disable the ability of your users to change the text size. If your design falls apart when you increase or decres the text size one or two sizes, then I say make the design better/ more fluid. If you must have this feature. Learn Flash.
I thing, only IE don't enlarge font, when you set the size exact in px. And I agre with eruct and others. Every browser has litle diferent font size so don't optimize your size for one exact browser and its settings, you have on your computer. Its not hard to make "em" web 