小编jhs*_*rbt的帖子

为什么柱子颜色不同?

我用div制作了一张桌子,我希望每隔一行都有不同的颜色.但每列都有不同的颜色.问题是什么?

.mTable {
  display: table;
  width: auto;
  background-color: #eee;
  border: 1px solid #666666;
}

.mTableRow {
  display: table-row;
  width: auto;
  clear: both;
}

.mTableHeading {
  display: table-header-group;
  background-color: #ddd;
  height: auto;
  color: black;
  text-align: center;
  border-bottom: 1px solid #000000;
  border-bottom: 1px solid #000000;
}

.mTableCell,
.mTableHead {
  display: table-cell;
  padding: 5px;
  border: 1px solid #999999;
  text-align: center;
  color: black;
  border-bottom: 1px solid #000000;
  width: 200px;
  background-color: #ccc;
}

.mTableRow>div:nth-child(even) {
  background: blue;
}
Run Code Online (Sandbox Code Playgroud)
<div class="mTable">
  <div class="mTableRow">
    <div class="mTableHead">ID</div>
    <div …
Run Code Online (Sandbox Code Playgroud)

html css

3
推荐指数
1
解决办法
69
查看次数

标签 统计

css ×1

html ×1