Copy code The code is as follows:
function getTagStyle(){
$minFontSize=8; //Minimum font size , you can change it as needed
$maxFontSize=18; //Maximum font size, you can change it as needed
return 'font-size:'.($minFontSize+lcg_value()*(abs($maxFontSize- $minFontSize))).'px;color:#'.dechex(rand(0,255)).dechex(rand(0,196)).dechex(rand(0,255));
}
The function of this function is to output random styles, including font-size and color.
If you want to specify only a few font sizes to be displayed instead of completely random, please modify the above function code to:
Copy code The code is as follows:
function getTagStyle(){
$sizearray = array('8',' 9','10','11','12','20'); //Customize the font size, you can modify it as needed
return 'font-size:'.$sizearray[rand(0, count($sizearray))].'pt;color:#'.dechex(rand(0,255)).dechex(rand(0,196)).dechex(rand(0,255));
}
http://www.bkjia.com/PHPjc/313587.htmlwww.bkjia.comtruehttp: //www.bkjia.com/PHPjc/313587.htmlTechArticleCopy the code as follows: function getTagStyle(){ $minFontSize=8; //Minimum font size, as needed Change it yourself $maxFontSize=18; //Maximum font size, you can change it as needed...