【问题标题】:input text width not 100% responsive on all devices在所有设备上输入文本宽度不是 100% 响应
【发布时间】:2015-06-02 07:50:55
【问题描述】:

我喜欢这个 StackOverFlow 问题,它似乎对我的情况有意义: Input text box and width 100%

我只是想在所有设备/尺寸(240、320、480、768、1024)上创建一个 100% 宽的 input type="text" 表单(用户在其中输入信息)。

我的 HTML 是:

<div align="left">
            <table>
              <tr>
                <td>First Name:</td>
                <td>input type="text" name="first_name" style="width: 100%;" />
                </td>
              </tr>
            </table>

我的 CSS:

input { width: 100%; }

我似乎无法将输入文本区域设为 100% 宽???在 iphone (320) 上它太宽了,让你向左/向右滚动。有什么建议?谢谢!

问候,

【问题讨论】:

    标签: css html responsive-design


    【解决方案1】:

    我认为你需要的是先设置表格的宽度,也是第一个,像这样:

    <div>
      <table style="width:100%;">
        <tr style="width:100%;">
          <td style="width:8em;">First Name:</td>
          <td><input type="text" name="first_name" style="width:100%;" />
          </td>
        </tr>
      </table>
    </div>

    【讨论】:

    • 谢谢!这适用于 IE/Chrome。但在 iphone (320) 上,它仍然太宽,让您向左/向右滚动。那里有什么建议吗?另外-可以使用 style="width:100%;"出于响应“移动友好”的原因而在表格中?我被告知我们不应该再在表格中指定宽度?谢谢!
    • 对不起,我不知道我是否标记了你
    猜你喜欢
    • 1970-01-01
    • 1970-01-01
    • 2013-09-22
    • 2012-02-15
    • 1970-01-01
    • 2018-01-24
    • 2015-05-07
    • 2016-08-16
    • 2018-09-22
    相关资源
    最近更新 更多