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

我正在使用带单元格中的表单元素的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>
wuliangshow 回答:如何使具有表单元素的物化表更紧凑

这只是一个小的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>
本文链接:https://www.f2er.com/3126350.html

大家都在问