html - 如何使具有表单元素的物化表更紧凑

标签 html css forms materialize

我正在使用 materiailze CSS 和单元格中的表单元素对时间表进行编码。我不喜欢表格行的高度。有什么办法可以使表格更紧凑吗? 如果这是物化的限制,什么是更好的 CSS 框架选项?

    <head>
      <link href="https://fonts.googleapis.com/icon?family=Material+Icons" rel="stylesheet">
      <script src="https://ajax.googleapis.com/ajax/libs/jquery/2.1.1/jquery.min.js"></script>
      <link rel="stylesheet" href="https://cdnjs.cloudflare.com/ajax/libs/materialize/1.0.0/css/materialize.min.css">
      <script src="https://cdnjs.cloudflare.com/ajax/libs/materialize/1.0.0/js/materialize.min.js"></script>
    </head>
    <body>
      <form>
      <table>
        <col width=100>
        <col width=100>
        <col width=100>
        <col width=100>
        <col width=200>
        <thead>
          <tr>
              <th>Date</th>
              <th>Time</th>
              <th>Date</th>
              <th>Time</th>
              <th>Type</th>
          </tr>
        </thead>
        <tbody>
          <tr>
            <td><input type="date" name="day" value="2019-01-01"></td>
            <td><input type="time" name="day" value="10:00"></td>
            <td><input type="date" name="day" value="2019-01-01"></td>
            <td><input type="time" name="day" value="18:30"></td>
            <td>
                <select>
                  <option value=1>Regular shift</option>
                  <option value=2>Vacation</option>
                </select>
            </td>
            <td><input name="day"></td>
          </tr>
        </tbody>
      </table>
      </form>
      <script type="text/javascript" src="js/materialize.min.js"></script>
    </body>

最佳答案

这只是一个小的 css 修复...

例如,您可以添加这一小段代码:

<style>
td {padding: 2px 5px;}
td input{margin:0 !important;height:2em !important;}
td .select-wrapper input.select-dropdown{height:2em;line-height:2em;}
</style>

关于html - 如何使具有表单元素的物化表更紧凑,我们在Stack Overflow上找到一个类似的问题: https://stackoverflow.com/questions/58796064/

相关文章:

javascript - formaction、formmethod、formenctype通过jQuery提交

javascript - 使用 javascript 传递隐藏字段的特定值

python - webapp2 self.request.get 返回 nil

jquery - 菜单悬停,页面透明度变为0.5

internet-explorer - IE 问题 : Transparent div above a picture doesn't trigger the CSS:hover

PHP注册页面

html - 如何禁用特定表列中的类?

javascript - Glyphicon 日历未打开

html - 如何使用 XSLT 将 HTML 百分比编码转换为 Unicode?

javascript - 我想让一个词在鼠标悬停期间执行 CSS 动画后消失