1

我有一个工作正常的网站,除了输入字段和旁边的提交按钮。它们无法在 iPad 上正确显示。输入框的高度略高于提交按钮,看起来怪怪的。

我个人认为 iPad 是 safari-mobile,具有不同的视口(1024px)等,但呈现与 Chrome 相同的 webkit 外观。那为什么输入框在 iPad 上显示不一样呢?


以下是它在我桌面上的 Google Chrome 中的外观:

桌面版输入框

这是它在 iPad 上的外观:

iPad上相同的输入框

HTML 部分很简单:

<div id="search-form">
    <input id="Search" class="defaultText defaultTextActive" title="search shzamm!" type="text" spellcheck="false">
    <input onclick="javascript:someFunction();" type="button" value="Go" class="search_btn">
</div>

同样的CSS是:

#search-form {
    overflow: auto;
    box-shadow: -1px 1px 3px rgba(0, 0, 0, 0.1);
    margin-bottom: 26px;
}

input#Search {
    -webkit-appearance: none;
    border-radius: 0;
    -webkit-border-radius: 0;
}

.defaultText {
    width: 88%;
    padding-left: 4px;
    height: 29px;
    float: left;
    background-color: #f7f7f7;
    border-right: 0px solid #666;
    border-bottom: 1px solid #666;
    border-color: #999;
    margin-right: -33px;
}

.defaultTextActive {
    color: #999;
    font-style: italic;
    font-size: 15px;
    font-weight: normal;
}

.search_btn {
    font-size: 13px;
    font-weight: bold;
    height: 34px;
    cursor: pointer;
    float: right;
    margin: 0;
    width: 33px;
    background: url("../images/search.jpg") no-repeat;
    text-indent: -99999px;
    border: 1px solid #999;
    border-top: 2px solid #000;
    margin-top: 0px;
    margin-right: 1px;
}

如您所见,输入的边框效果在 iPad 中也没有正确呈现。有人对此有任何线索吗?

4

3 回答 3

5

这个 CSS 片段将从您的文本框中删除默认的 WebKit 样式:

input[type="text"] {
    -webkit-appearance : none;
    border-radius      : 0;
}

也适用于 iOS 7。

于 2013-12-03T11:02:01.967 回答
4

尝试使用 -webkit-appearance 摆脱默认样式。

检查此问题: iOS 在输入上强制圆角和眩光 https://stackoverflow.com/a/14758383

于 2013-11-06T15:20:43.547 回答
0

请用 :

-webkit 外观:无;

于 2019-12-06T10:09:11.970 回答