jquery autogrow 和 yui-reset 会导致 IE7 中出现不良行为

发布于 2024-07-27 19:56:05 字数 1304 浏览 1 评论 0原文

我在同一个站点上一起使用 YUI Reset 和 jquery AutoGrow 。 它在 Firefox 上运行良好,但在 IE 7 上表现不佳。 文本区域变得很大,即使其中只有少量文本。

下面是一个演示该问题的示例。 如果我注释掉重置样式表,自动增长就会正常运行。

我希望有一些简单的 CSS 可以覆盖它来解决这个问题。 我已经深入这个项目以摆脱 YUI 重置。

<!DOCTYPE html PUBLIC "-//W3C//DTD XHTML 1.0 Transitional//EN" "http://www.w3.org/TR/xhtml1/DTD/xhtml1-transitional.dtd">
<html xmlns="http://www.w3.org/1999/xhtml" >
<head>
    <title></title>
    <link href="http://yui.yahooapis.com/2.7.0/build/reset/reset-min.css" rel="stylesheet" type="text/css" />
    <script src="http://ajax.googleapis.com/ajax/libs/jquery/1.3/jquery.min.js" type="text/javascript"></script>
    <script src="http://www.aclevercookie.com/files/jquery.autogrow.js" type="text/javascript"></script>
    <script type="text/javascript">
        $(function() {
            $("textarea").autogrow();
        });
    </script>
    <style type="text/css">
        textarea
        {
            width: 99%;
            line-height: 18px;
        }
    </style>
</head>
<body>
    <textarea>abc</textarea>
    <textarea>this quantity of text should not cause the textarea to grow yet.</textarea>
</body>
</html>

I am using YUI reset and jquery AutoGrow together on the same site. It works fine on firefox, but IE 7 behaves badly. The textarea grows way to big with even a small amount of text in it.

Below is an example that demonstrates the problem. If I comment out the reset stylesheet, the autogrow behaves properly.

I am hoping there is some simple css that I can override that will fix this. I am way to far into this project to switch away from YUI reset.

<!DOCTYPE html PUBLIC "-//W3C//DTD XHTML 1.0 Transitional//EN" "http://www.w3.org/TR/xhtml1/DTD/xhtml1-transitional.dtd">
<html xmlns="http://www.w3.org/1999/xhtml" >
<head>
    <title></title>
    <link href="http://yui.yahooapis.com/2.7.0/build/reset/reset-min.css" rel="stylesheet" type="text/css" />
    <script src="http://ajax.googleapis.com/ajax/libs/jquery/1.3/jquery.min.js" type="text/javascript"></script>
    <script src="http://www.aclevercookie.com/files/jquery.autogrow.js" type="text/javascript"></script>
    <script type="text/javascript">
        $(function() {
            $("textarea").autogrow();
        });
    </script>
    <style type="text/css">
        textarea
        {
            width: 99%;
            line-height: 18px;
        }
    </style>
</head>
<body>
    <textarea>abc</textarea>
    <textarea>this quantity of text should not cause the textarea to grow yet.</textarea>
</body>
</html>

如果你对这篇内容有疑问,欢迎到本站社区发帖提问 参与讨论,获取更多帮助,或者扫码二维码加入 Web 技术交流群。

扫码二维码加入Web技术交流群

发布评论

需要 登录 才能够评论, 你可以免费 注册 一个本站的账号。

评论(1

等待圉鍢 2024-08-03 19:56:05

我在 IE8 中也遇到了同样的问题,但它与 YUI 重置无关,似乎是 YUI 字体导致了问题。

通过将字体大小设置为 1em 修复了该问题。 试一试吧。

I had this same problem in IE8, but rather than it being related to YUI reset, it seemed to be YUI fonts causing the problem.

Fixed it by setting font-size to 1em. Give that a go.

~没有更多了~
我们使用 Cookies 和其他技术来定制您的体验包括您的登录状态等。通过阅读我们的 隐私政策 了解更多相关信息。 单击 接受 或继续使用网站,即表示您同意使用 Cookies 和您的相关数据。
原文