【问题标题】:horizontally align elements in a table cell on a single line在单行上水平对齐表格单元格中的元素
【发布时间】:2021-02-21 04:46:02
【问题描述】:

在我的表格中,我有一列包含两个按钮和一个输入元素。它是有序的;减号按钮,输入,加号按钮。然而,这些元素都是垂直对齐的。我似乎无法为我的特定情况找到解决方案。如何让它水平对齐。

html:

<td class="text-center">
  <button class="page-btn" type="submit" value="foil-{{ card.card_id }}" onclick="minus_inventory(this.value)" tabindex="-1">
    <img class="icon" src="{% static 'base/img/icons/minus.png' %}" alt="Filter Sets">
  </button>
  <input type="number" id="foil-{{ card.card_id }}" class="page-input-inventory" maxlength="3" autocomplete="off" value="{{ card.foil }}" tabindex="2">
  <button class="page-btn" type="submit" value="foil-{{ card.card_id }}" onclick="plus_inventory(this.value)" tabindex="-1">
    <img class="icon" src="{% static 'base/img/icons/plus.png' %}" alt="Filter Sets">
  </button>
</td>

css:

.page-btn {
  width: 1.5rem;
  margin: 0 .4rem;
  padding: 0;
  outline: none !important;
}
.page-btn .icon {
  filter: invert(99%) sepia(10%) saturate(424%) hue-rotate(204deg) brightness(114%) contrast(93%);
  width: 1.5rem;
  height: 1.5rem;
  margin: .125rem 0 .125rem 0;
  outline: none !important;
}
.table {
  color: #f6f6f6;
  font-size: .8rem;
}
.table-hover tbody tr:hover td, .table-hover tbody tr:hover th {
  color: #f6f6f6;
  background-color: #161d31;
}
.page-input-inventory {
  vertical-align: middle;
  text-align: center;
  font-size: .9rem;
  width: 3rem;
  height: 1.5rem;
  margin: .1rem auto;
  padding: 0 8px;
  background-color: #ffffff;
  border: 1px solid #dee2e6;
  border-radius: 6px;
  outline: 0 none !important;
}

截图:

【问题讨论】:

    标签: html css


    【解决方案1】:

    你试过了吗?

    xyz {
       display: inline;
    }
    

    【讨论】:

      猜你喜欢
      • 1970-01-01
      • 2013-10-03
      • 1970-01-01
      • 1970-01-01
      • 2016-12-05
      • 1970-01-01
      • 1970-01-01
      • 2018-03-28
      • 1970-01-01
      相关资源
      最近更新 更多