计算标签云中标签的字体大小的公式是什么? [英] What is the formula to calculate the font-size for tags in a tagcloud?

查看:19
本文介绍了计算标签云中标签的字体大小的公式是什么?的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!

问题描述

我有一个标签云,我需要知道如何更改最常用标签的字体大小.

I have a tag cloud and I need to know how can I change the font-size for the most used tags.

我需要设置最小字体大小和最大字体大小.

I need to set a min-font-size and a max-font-size.

推荐答案

您可以使用线性或对数评估与某个标签相关联的项目数量相对于最大标签,将其乘以最小值和最大值之间的差字体大小,然后将其添加到最小字体大小.例如,伪代码中的数学可能是:

You could use a linear or logarithmic assessment of the number of items associated with a certain tag relative to the largest tag, multiply it by the difference between minimum and maximum font sizes, then add it to the minimum font size. For example, the math in pseudocode might be:

let min = 12, max = 24
for each tag
    font = (items / items in biggest tag) * (max - min) + min

这篇关于计算标签云中标签的字体大小的公式是什么?的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!

查看全文
登录 关闭
扫码关注1秒登录
发送“验证码”获取 | 15天全站免登陆