Best tag for text size freedom in HTML???

Google isn’t doing me any favours here.

in the font tag you are (I think) limited to 1-7 and 7 isn’t very big at all.

When I learned ASP I wrote a while loop which increased the text size by 1 each time, and worked. I’m trying to do the same with PHP and it’s at best: Feeble

(while loop stops when the size gets to 500 but the actual text doesn’t get any bigger after 7!)

Doesn’t matter. I got it… :slight_smile:

$textsize = 5;
while($textsize < 500)
{
echo “<p><font style=font-size:$textsize>$a_variable</font></p>”;
++ $textsize;
}

You’re using CSS to set the font style in a <font> tag. That’s a tad nutty.

If you want to define inline arbitrary styles, use a <span>.

I’m pleased it works for you. I don’t mean to sound too critical but the use of font tags puts you back in the 20th century.

Seriously, if this is something for public viewing, you should take a look at using style sheets. It’s a much more flexible way to go, your pages will be “lighter” (ie less bandwidth and probably load faster) and you’ll show the world that you’re no longer working in 1999.

friedo’s right. I didn’t notice that you’re using a weird combination of both.

You could use <p style=“font-size: [variablenumber]pt;”>Text</p>

It’s not for public viewing… It’s for messing about and learning PHP, so getting the HTML/CSS right is secondary. (I lazilly chose the first thing that came into my head to give me control over the font: ‘font’) I know I should get into good habits so thanks for the comments :slight_smile: (no sarcasm meant)

Wouldn’t doing it ‘properly’ with CSS make it impossible to randomize the values every time?

“Randomize the values?” You ask? Ah yes… things have changed since the OP (mwah ha ha!)…
<?php

$chars = array(0,1,2,3,4,5,6,7,8,9,'a','b','c','d','e','f','g','h','i','j','k','l','m','n','o','p','r','s','t','u','w','x','y','z','A','B','C','D','E','F','G','H','I','J','K','L','M','N','O','P','R','S','T','U','W','X','Y','Z','?','!','#','@','%');
$count=0;
echo "&lt;p&gt;";
while($count &lt; 15000) 
{
	//srand(time());
	$textcolor =  dechex(rand(0,16700000));
	$textsize = (rand(1,150));
	$char =  $chars[rand(0,67)];
	
	echo "&lt;font style=font-size:$textsize;color:$textcolor&gt;$char&lt;/font&gt; 

";
++ $count;
}
echo “</p>”;

?>

You can specify font size in pixels in CSS (or inline styles), I think. Something like:

<p style=“font-size:20px”>Hello World</p>

Any particular reason you’re leaving out 77,215 possible colors? :wink:

Pure laziness. :smiley:

Well, at least this particular instance of laziness will prevent your rendered text from being completely invisible on a white background. Carry on!

Color you bored. No go find the #XXXXXX for that!

:smiley:

Funnily enough, when my office colleagues sampled my creation the exact words of one of them was “So you’re as bored today as we are?”

edit: the latest incarnation now randomizes the font and the x/y position, but firefox doesn’t display the wingdings or webdings fonts without a config change so it doesn’t look much different.

Latest code…

<?php

$chars = array(0,1,2,3,4,5,6,7,8,9,'a','b','c','d','e','f','g','h','i','j','k','l','m','n','o','p','r','s','t','u','w','x','y','z','A','B','C','D','E','F','G','H','I','J','K','L','M','N','O','P','R','S','T','U','W','X','Y','Z','?','!','#','@','%');
$fonts = array('abadi','French Script','Old English Text','Almanac','Garamond','Onyx','Andale Mono','Gautami','Palace Script','Andy Bold','Georgia','Parties','Arial','Gill Sans','Pepita','Arial Unicode','Gloucester Extra Condensed','Perpetua','Batang','Goudy Old Style','Placard Condensed','Bell','Gulim','Raavi','Bernard Condensed','Hei','Rockwell','Bodoni','Heisei','Runic Condensed','Bon Apetit','Holidays','Script Bold','Bookman Old Style','Impact','Shruti','Braggadocio','Imprint Shadow','Signs','Brush Script Italic','Kartika','SimHei','Calisto','Keystrokes','SimSun','Castellar','Kino','Sorts ','Sorts 2','Centaur','Latha','Sports 2','Sports 3','Century Gothic','Lucida','Symbol','Century Schoolbook','Mangal','Tahoma','Colonna','Matura Script Capitals','Times New Roman','Comic Sans','Mercurius Script Bold','Transport','Corsiva','Microsoft','Sans Serif','Trebuchet','Courier New','MingLiU','Tunga','Curlz','MS Gothic','Twentieth Century','Directions','MS Mincho','Vacation','Engravers','MV Boli','Verdana','Felix Titling','News Gothic','Vrinda','Footlight','Nina','Webdings','Forte','OCR A Extended','Wingdings');

$count=0;
echo "&lt;p&gt;";
while($count &lt; 5000) 
{
	$textcolor =  dechex(rand(0,16700000));
	$textsize = (rand(1,150));
	$char =  $chars[rand(0,count($chars))];
	$fontface = $fonts[rand(0,count($fonts))];
	$top=(rand(0,1024));
	$left=(rand(0,1280));
	
	echo "&lt;font  style=position:absolute;top:$top;left:$left;font-family:'$fontface';font-size:$textsize;color:$textcolor&gt;$char&lt;/font&gt; 

";
++ $count;
}
/*
while($count <= count($fonts))
{
$fontface = $fonts[$count];
echo "<font style=font-family:’$fontface’;font-size:30;>$fontface</font> 
";
++$count;
}*/
echo “</p>”;

?>

For those who are not able to replicate my PHP code this what it does…

That’s great, but can you do this?

Ummmm… Not yet.
It’s funny how homer has a tit for a face for a while :smiley:

edit: You can select him too…

o
o
o
o
(
O
O
O

L
(
O
O
O
O
O

L
(
O
|
|


|
|




(
(
8
o
o
o
(
(
8
o
o
o
o
)
)
b
o
O
o
o
o
o
o
o
)
b
o
O
o
o
o
o
o
o
o
o
o
/
/
/





_
_
_



C
C
O
(

I just discovered that including those colours changes things significantly. What I now get is a display of mostly the ‘warm’ colours (yellow, red, orange and the occasional green)…

Why does including a mere less than half a percent of extra colours yield such a significantly different result?

p.s. 256256256 = 16,777,216. And I am assuming you know what you are doing, so why does your number = one less than mine?

And… If I add another three levels of precision to my original 16,700,000 (16,777,200)I get the mostly cold colours!

Between 16,777,214 and 16,777,215 the colours switch from warm to cold. That’s weird.

edit: and because 16,700,000 seems to show a full range (emphasis on ‘seems’) then it appears to have been a very lucky accident. It achieves my goal of being truly random colour wise.

you could set the font in CSS in pixles say 10pt then use a pecent increase.

body{font-size: 10pt}
h1{font-size: 105%}