gpt4 book ai didi

android - 跨平台设置输入文本框大小的更好方法?

转载 作者:行者123 更新时间:2023-11-28 14:23:39 26 4
gpt4 key购买 nike

更新在代码块下方。

原始问题:我有一个输入字段远远超出了页面的其余部分,但正如问题所暗示的那样,它在 iOS3/4/5 中看起来很好。

我想知道是否有人遇到过这个问题。我的搜索按钮在 iOS 中位于搜索文本框的右侧,在其他平台上实际上换行到下一个“行”。

代码如下:

HTML

<form action="/jsp/mobile_files/results.jsp" method="get" autocorrect="off"     autocapitalize="off">
<h1><input class="keyword_search" type="text" name="keywords" maxlength="50" size="36" value="" /><input type="submit" class="keyword_submit" value="Go" /></h1>
</form>

两个相关的 CSS 类是:

 /* input[type="submit"] */
.keyword_submit
{
background: #666666; /* grey */
color: #FFFFFF; /* white */
font-weight: bold;
font-size: 60%;
line-height: 1.45em; /* 1.45 with 60% font-size */

margin-left: -4px; /* to do - needs to be -12 for desktop */
padding-bottom: 1px;


-moz-border-radius: 10px; /* for mozilla firefox */

/* NOTE: CSS3 rounded corners not work on iPhone 3G with iOS 3.x */
border-radius: 10px;

/* webkit rounded corners work on iPhone 3G with iOS 3.x */
-webkit-border-radius: 10px;


-moz-border-radius-topleft: 0px; /* for mozilla firefox */
-moz-border-radius-bottomleft: 0px;

/* NOTE: CSS3 rounded corners not work on iPhone 3G with iOS 3.x */
border-top-left-radius: 0px;
border-bottom-left-radius: 0px;

/* but this does work on iPhone 3G with iOS 3.x */
-webkit-border-top-left-radius: 0px;
-webkit-border-bottom-left-radius: 0px;

/* to do - possible without this?? We lose the gradient! */
-webkit-appearance: none;
}

/* input[type="text"] */
.keyword_search {
background: #F1F1F1; /* faded white */
color: #333333; /* dark */
font-weight: bold;

/* to do - looks better on iOS with larger font */
/*
font-size: 80%;
*/

-moz-border-radius: 10px; /* for mozilla firefox */

/* NOTE: CSS3 rounded corners not work on iPhone 3G with iOS 3.x */
border-radius: 10px;

/* webkit rounded corners work on iPhone 3G with iOS 3.x */
-webkit-border-radius: 10px;

margin-left: 0.75em; /* moves entry field to the right */
padding-left: 0.6em; /* moves text start cursor in the entry field to the right */

/* for mozilla firefox */
-moz-border-radius-topright: 0px;
-moz-border-radius-bottomright: 0px;

/* NOTE: CSS3 rounded corners not work on iPhone 3G with iOS 3.x */
border-top-right-radius: 0px;
border-bottom-right-radius: 0px;

/* but this does work on iPhone 3G with iOS 3.x */
-webkit-border-top-right-radius: 0px;
-webkit-border-bottom-right-radius: 0px;
}

更新问题截图可见http://i.stack.imgur.com/5f7C8.jpg我会在这里发布它,但我需要超过 10 个声誉才能发布图像。您可以在 Android 图像中看到如果我的输入大小对于任何平台都设置得太大会发生什么。为了使其适合 BlackBerry,您可以查看它对 iOS 中呈现的大小所做的处理。所有三个 img 的大小都设置为相同的值 (="10")...您可以在不同的平台上看到结果。

<input class="keyword_search" type="number" name="job_order_id" maxlength="7" size="10" value="" />
<input type="submit" class="keyword_submit" value="Go" />

关于控制大小的更好方法的建议?我可以使用 %、em、px 或一些跨平台更一致的单位吗?(在我整理好尺寸后,我会担心如何消除间隙,按钮的尺寸和其他调整)

最佳答案

当回来尝试其他一些事情时,我发现我错了。上面的注释是使用 size=#% 进行的,但是当您使用 width: #%; 时,它消除了跨平台的广泛差异。

关于android - 跨平台设置输入文本框大小的更好方法?,我们在Stack Overflow上找到一个类似的问题: https://stackoverflow.com/questions/8251358/

26 4 0
Copyright 2021 - 2024 cfsdn All Rights Reserved 蜀ICP备2022000587号
广告合作:1813099741@qq.com 6ren.com