开发者

IE font size decrease does not cause select box height to decrease

I have a font resize function on my page which increases the font size via javascript for the entire page.

This works fine in most browsers except IE. When decreasing the font size after increasing it, the s开发者_Go百科elect boxes new height does not decrease, even though the font size is decreasing on it. Instead the smaller font appears to be padded with white space.

Any ideas as to what IE is doing here, and a work around?

function setFontSize(newFontSize)
   $('select').css("font-size", newFontSize);
}


After IE renders the select box, you cannot change the style of it with javascript (only adding, removing elements, not style or stuff like that). That's not a good thing.

As a work-around what I've done is creating a new select box (clone of the first) with the style that I desire, and then add it as a child of the container tag. That will display it correctly.

0

上一篇:

下一篇:

精彩评论

暂无评论...
验证码 换一张
取 消

最新问答

问答排行榜