At the PHP side we need to change a few things currently this is the code:
1 2 3
We’ll be change that into this:
1 2 3 4 5
As you can see a few things change. First off we also supply the min and maxSize options. The helper uses these and calculates a number in between those values, we’ll use those numbers for the CSS classes later on. A option that change is before as you can see %size% is now used for a class, this class will contain it’s font-size and any options you might want to add yourself.
Generating the CSS
If your lazy and just want a working example you can skip this bit and skip to
The CSS. Since the example requires 50 css class and it takes alot of time to calculate the required values by hand I’ve a little script to do it for me/us.
1 2 3 4 5 6 7 8 9 10 11
The script has a few configuration values.
- class - the prefix to the %size% value
- start_size - the smallest possible tag size in em
- stop_size - the biggest possible tag size in em
- count - The number of classes and for now 50 :)
- precision - the maximum of digest behind the dot
1 2 3