Warning: file_get_contents(/data/phpspider/zhask/data//catemap/3/html/85.json): failed to open stream: No such file or directory in /data/phpspider/zhask/libs/function.php on line 167

Warning: Invalid argument supplied for foreach() in /data/phpspider/zhask/libs/tag.function.php on line 1116

Notice: Undefined index: in /data/phpspider/zhask/libs/function.php on line 180

Warning: array_chunk() expects parameter 1 to be array, null given in /data/phpspider/zhask/libs/function.php on line 181

Warning: file_get_contents(/data/phpspider/zhask/data//catemap/7/css/39.json): failed to open stream: No such file or directory in /data/phpspider/zhask/libs/function.php on line 167

Warning: Invalid argument supplied for foreach() in /data/phpspider/zhask/libs/tag.function.php on line 1116

Notice: Undefined index: in /data/phpspider/zhask/libs/function.php on line 180

Warning: array_chunk() expects parameter 1 to be array, null given in /data/phpspider/zhask/libs/function.php on line 181
Html 在表格单元格之间使用CSS作为纯色背景_Html_Css - Fatal编程技术网

Html 在表格单元格之间使用CSS作为纯色背景

Html 在表格单元格之间使用CSS作为纯色背景,html,css,Html,Css,考虑一下: HTML: 我希望第一行的背景色也在单元格之间 我该怎么做呢?很抱歉,根据第17.5.1节的最后一段,使用“边框折叠:分隔”时单元格之间的背景是表格元素的背景。使用边框间距时,这是不可能的,但您可以尝试使用单个单元格填充来代替 table { border-collapse: separate; } tr:first-child td { background-color: #aaa; } td { padding: 10px 40px; } 可在此处找到ngh。。。不

考虑一下:

HTML:

我希望第一行的背景色也在单元格之间


我该怎么做呢?

很抱歉,根据第17.5.1节的最后一段,使用“边框折叠:分隔”时单元格之间的背景是表格元素的背景。

使用边框间距时,这是不可能的,但您可以尝试使用单个单元格填充来代替

table {
  border-collapse: separate;
}
tr:first-child td {
  background-color: #aaa;
}
td {
  padding: 10px 40px;
}

可在此处找到

ngh。。。不要将表格用于非表格数据。不要真正理解这个问题!请指定!
table {
    border-spacing: 40px 10px;
    border-collapse: separate;
}
tr:first-child {
    background-color: #aaa;
}
td {
    padding: 5px;
}
table {
  border-collapse: separate;
}
tr:first-child td {
  background-color: #aaa;
}
td {
  padding: 10px 40px;
}