【问题标题】:jQUery ui buttons some issues in IE7jQUery ui按钮IE7中的一些问题
【发布时间】:2011-09-08 21:19:45
【问题描述】:

我正在使用 jquery UI 按钮:

$(document).ready(function() {
    $("a.button, .button, button, input:submit, input:button").button();
})

<p>
    <button type="submit" value="Back">Back</button> &nbsp;&nbsp;<a class="button" id="register">Continue</a>
</p> 

在所有浏览器中,按钮看起来完全一样,但是当我检查 IE7(从 IE9 切换到兼容模式)时,Back 按钮有黑色边框,Continue 按钮向下移动了几个像素。

这里是 jsfiddler 链接http://jsfiddle.net/XJRVt/7/

我还查看了 IETester 它在 IE6 中的外观和在 IE7 中的外观:(

可能有人知道如何解决这个问题?

【问题讨论】:

    标签: jquery jquery-ui internet-explorer-7


    【解决方案1】:

    似乎是因为 IE6/IE7 为元素使用了不同的标准样式集。如果你使用 CSS Reset 或 CSS Normalize 框架会很有效:)

    尝试使用 Normalize.css (https://github.com/necolas/normalize.css/),它至少修复了浮动问题。

    所以不是 Jquery UI 弄乱了布局,而是 IE!

    尝试插入:

    button, input, select, textarea { font-size: 100%; margin: 0; vertical-align: baseline; *vertical-align: middle; }
    /*
     * 1. Define line-height as normal to match FF3/4 (set using !important in the UA stylesheet)
     * 2. Correct inner spacing displayed oddly in IE6/7
     */
    button, input { line-height: normal; *overflow: visible; }
    /*
     * Reintroduce inner spacing in 'table' to avoid overlap and whitespace issues in IE6/7
     */
    table button, table input { *overflow: auto; }
    

    【讨论】:

    • 您绝对可以这样做。但是,如果您使用 Normalize.css 文件,您还可以修复其他浏览器(如 Safari/Chrome/Firefox 等)中的问题。这样您就可以将其放入通用 CSS 文件中。但是如果你只想做 IE6/IE7 瞄准你的钱就对了:)
    • 我应该把它放在单独的 css 文件中,并且只有在检查旧浏览器是否包含它之后?
    • 这如何规范化 css 工作?我只需要包括那个女巫所有其余的css文件吗?不需要浏览器检查?
    猜你喜欢
    • 1970-01-01
    • 2011-03-18
    • 2011-02-09
    • 1970-01-01
    • 1970-01-01
    • 1970-01-01
    • 1970-01-01
    • 1970-01-01
    • 1970-01-01
    相关资源
    最近更新 更多