【发布时间】:2012-09-07 21:09:25
【问题描述】:
我有一个 jQuery 函数,可以重新调整页面中许多元素的字体大小和行高,包括 p 和 p.latest_news。 除 p.latest_news 外,该函数与所有其他元素均按预期工作
应用于 p.latest_news 的 font-size 和 line-height 等于 p no 类(即 $('p').css({... )
jQuery.1.7.1
代码
$('p.article_news').css({
'font-size' : Math.max(11,(.9 * newFontSize)),
'line-height' : Math.max(13,(1.1 * newFontSize))+'px'
});
$('p').css({
'font-size' : Math.max(14,newFontSize),
'line-height' : Math.max(21,(1.7 * newFontSize))+'px'
});
如果我只使用
$('p.article_news').css({
'font-size' : Math.max(11,(.9 * newFontSize)),
'line-height' : Math.max(13,(1.1 * newFontSize))+'px'
});
p.article_news 字体大小和行高按预期变化
为什么会这样? 如何影响每个 p、class 和 classless?
谢谢
【问题讨论】: