You need to enable JavaScript to run this app.
优惠活动
大模型
产品
解决方案
定价
更多

如何在带文本的矩形内制作小正方形?附Bootstrap表格复现场景

嘿,我已经搞定啦!用HTML和CSS完美复现了目标截图的效果,还搭建了对应的演示环境。这次我选用Bootstrap 4来构建表格组件,以下是生成表格行的核心代码片段:

HTML 代码

<div class="body-manage-attendees"> 
  <table class="table table-hover"> 
    <thead> 
      <tr> 
        <th scope="col">Name</th> 
        <th scope="col" class="number">Number</th> 
        <th scope="col" class="table2">...</th>
      </tr>
    </thead>
    <!-- 这里可以添加表格的tbody行内容 -->
  </table>
</div>

CSS 代码

针对表格的自定义样式(比如调整列宽、对齐方式等),我写了这些规则:

/* 容器样式,控制表格的布局范围 */
.body-manage-attendees {
  padding: 1.5rem;
  max-width: 1200px;
  margin: 0 auto;
}

/* 自定义数字列的样式 */
.number {
  width: 15%;
  text-align: center;
  font-weight: 500;
}

/* 右侧操作列的样式 */
.table2 {
  width: 20%;
  text-align: right;
}

内容的提问来源于stack exchange,提问作者flash

相关产品推荐
方舟 Agent Plan

超全模态模型 × Harness 升级,最新支持 Deepseek-V4.1-Flash、GLM-5.3 系列、Doubao-Seedream-5.0-pro、Kimi-K3 (部分), 限时 9.9 元起

最近更新时间:2026.05.22 09:43:21