javascript - 输入位置在 Iphone 上无法正确显示

标签 javascript html css iphone input

我被输入表单卡住了。当我在开发人员控制台中检查它时,一切正常。但是当我从我的 iPhone 检查它时,它的位置大约改变为 1-2px。我用相同尺寸的安卓手机检查了一下,一切正常。 在开发控制台中输入 Iphone 5 - http://cs629525.vk.me/v629525181/40c5e/zrdadYwKeBU.jpg . 从我的 iphone 5s 输入 - http://cs629525.vk.me/v629525181/40c57/KjsRhwnjQ4k.jpg . 代码如下

<form id="subscribe">
            <input type="text" class="enter-email" name="subscribe-email" id="subscribe-email" placeholder="YOUR EMAIL" spellcheck="false" />
            <button type="submit" id="signup-button" class="signup-button c-form">NOTIFY ME</button>
            <label for="subscribe-email" class="subscribe-message c-form"></label>
        </form>
<!--css-->
.enter-email {
margin-top: 30px;
margin-left: 17.5%;
width: 40%;
font-size: 16px;
height: 50px;
background: none;
border: 2px solid white;
color: #fff;
text-align: center;
outline: none;
-webkit-transition: all 0.5s ease;
transition: all 0.5s ease;}

.signup-button {
height: 50px;
border: 2px solid white;
color: white;
text-align: center;
padding: 5px;
font-size: 16px;
width: 25%;
background: #32dbd0;
margin-left: -6px;
transition: all 0.4s ease;}

::-webkit-input-placeholder {
color: #fff;
font-size: 16px;
text-align: center;
padding: 1px; }

最佳答案

将以下内容添加到您的两个元素中:

.enter-email {
    vertical-align: top;
    ...
}

.signup-button {
    vertical-align: top;
    ...
}

按钮和输入默认是行内 block 。这将迫使它们在同一级别对齐。

关于javascript - 输入位置在 Iphone 上无法正确显示,我们在Stack Overflow上找到一个类似的问题: https://stackoverflow.com/questions/36635671/

相关文章:

javascript - 以百分比给出省略号

javascript 添加 aria 属性

用于范围关闭的 Javascript 自调用匿名函数

javascript - 注入(inject) Controller 时出现 Angular 模块注入(inject)错误

javascript - 用于更改图片大小或单元格(包含图片)大小的 HTML 或 Javascript 按钮

php - 发送抓取请求以获取 torrent 的种子和同行

javascript - 在引导双列表框中,在选择一个选项时,我只想将一个值与 value 属性内的所有其他值分开

html - css:我无法应用背景颜色

html - 如何设置默认浏览器窗口坐标 View ?

html - 除了一个 div 之外,整个 body 标签上的 CSS 不透明度