这个没有必要吧?如果是针对标题和正文的,标题标签可以统一设置字体,多一行而已,我觉得这样反而弄得复杂了。
-- Best Regards! Roger Shi GTalk & Mail: [email protected] MSN: [email protected] Blog: http://fdream.net Twitter: http://twitter.com/xushengs/ <http://twitter.com/xushengs/> Weibo: http://weibo.com/fdream/ 2012/11/14 张立理 <[email protected]> > if (parseInt(getComputedStyle(element, > null).getPropertyValue('font-size'), 10) > 12) { > element.style.fontFamily = '微软雅黑'; > } > else { > element.style.fontFamily = '宋体'; > } > > 就是将以上代码变成CSS可以实现吧,比如: > > @font-series auto-scale { > 1 { > from: 0; > to: 12px; > font-family: '宋体'; > font-weight: normal; > } > 2 { > from: 13px; > font-family: '微软雅黑'; > font-weight: bold; > } > } > > #element { > font-series: auto-scale; > } > > 虽然个人觉得没有必要就是了,字体的大小是不是以CSS的值为基准,设计的目标是什么? > > > 12px的字体,在一个普通的1080P的23寸屏幕上,和一个2560x1440的27寸的屏上,实际可识别的大小显然是不同的,同时还有zoom等的影响,仅以字号为基准,个人认为并不具备足够的意义。 > > > Gray Zhang > ------------------------------------------- > [email protected] > http://www.otakustay.com (Broken) > > > > Date: Wed, 14 Nov 2012 21:45:32 +0800 > > From: [email protected] > > To: [email protected]; [email protected] > > Subject: 靠字的大小選用不同的字體 > > > > > 節錄錦江在群裡講的話: > > > > # 勾三股四: 12:47:48 > > # 我希望将来CSS可以满足这种需求: > > # 大于12px的字用雅黑、小于等于12px的字用宋体 > > # > > # 勾三股四: 12:49:19 > > # 其实现在很多网页的设计都有这个规律 > > # 正文的小字一种字体,大标题一种字体 > > > > 有誰知道這能不能用 @font-face 達到嗎? > > > > # 勾三股四: 12:49:49 > > # 再抽象一些 就是根据css属性的值进行样式筛选 > > > > 這是什麼意思? > > > > > > 以上 > > > > Kenny > > -- > > Web Specialist, Oupeng Browser, Beijing > > Try Oupeng: http://www.oupeng.com/ > > >
