【问题标题】:How to center one grid template column如何使一个网格模板列居中
【发布时间】:2021-01-28 17:25:13
【问题描述】:

我目前所有网格模板列都向左对齐:但是我只希望编辑列在中心对齐,有人可以告诉我如何做到这一点。

.ScheduleGrid {
  display: grid;
  grid-template-columns: [id]minmax(0, .9fr) [interval]minmax(0, 1fr) [project-id]minmax(0, 2fr) [database]minmax(0, 5fr)
    [create-timestamp]minmax(0, 2fr) [create-user-id]minmax(0, 1fr) [edit]minmax(0, 2.5fr);
  column-gap: 10px;
  padding: 8px;
  text-align: left;
}

【问题讨论】:

  • 请提供足够的代码来重现问题。

标签: html css css-grid


【解决方案1】:

选择“编辑”div,然后使用justify-self: center; 将其沿列居中

【讨论】:

    猜你喜欢
    • 1970-01-01
    • 1970-01-01
    • 1970-01-01
    • 1970-01-01
    • 1970-01-01
    • 1970-01-01
    • 1970-01-01
    • 1970-01-01
    • 1970-01-01
    相关资源
    最近更新 更多