IE字体大小减小不会导致选择框高度减小 [英] IE font size decrease does not cause select box height to decrease

查看:117
本文介绍了IE字体大小减小不会导致选择框高度减小的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!

问题描述

我在我的页面上有一个字体大小调整功能,通过整个页面的javascript增加字体大小。

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

这在大多数浏览器(IE除外)中正常工作。在增加字体大小后减小字体大小时,选择框的新高度不会减小,即使字体大小正在减小。

This works fine in most browsers except IE. When decreasing the font size after increasing it, the select 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.

关于IE在这里做什么以及一个解决方案的任何想法?

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

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


推荐答案

IE呈现选择框,你不能改变它的样式与javascript(只添加,删除元素,不是样式或东西)。这不是一件好事。

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.

这篇关于IE字体大小减小不会导致选择框高度减小的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!

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