如何定位最后的TD细胞?

时间:2016-04-08 03:32:19

标签: html css web

如何让特定的TD不从表中继承CSS样式?

enter image description here

我应该如何使最右边的列没有任何背景?

table {
  font-family:Arial, Helvetica, sans-serif;
  color:#666;
  font-size:12px;
  text-shadow: 1px 1px 0px #fff;
  background:#eaebec;
  margin:20px;
  border:#ccc 1px solid;

  -moz-border-radius:3px;
  -webkit-border-radius:3px;
  border-radius:3px;

  -moz-box-shadow: 0 1px 2px #d1d1d1;
  -webkit-box-shadow: 0 1px 2px #d1d1d1;
  box-shadow: 0 1px 2px #d1d1d1;
}

就目前而言,即使我将背景设置为透明,背景#eaebec也会显示最右边的TD。

感谢所有帮助。

2 个答案:

答案 0 :(得分:1)

:last-of-type selector会有所帮助:

lines = multi_line_text.split("\n") tempplace = 0 place = 5#starting pixel positioning while tempplace != len(lines): text = font.render(lines[tempplace], False, white, black) game_window.blit(text, (5, place)) place = place + 15#Pixel positioning increment tempplace = tempplace + 1 是表格背景 你有两个解决方案,

解决方案1:

从表中删除背景并执行:

#eaebec

解决方案2:

只设置每个最后TD的背景

td{
    background: #eaebec;
}
td:last-of-type{
    background: none;
}

答案 1 :(得分:0)

  

就目前而言,即使我将背景设置为透明,背景#eaebec也会显示最右边的td'

你的桌子有背景颜色,现在如果你使你的td背景颜色透明,它会使td透明,你期望透明的颜色是什么?它只是透明,然后当它透明时,你可以透过,后面是具有背景颜色的桌子。

  

我应该如何使最右边的列没有任何背景?

在您的方案中,您可以为上一个td设置所需的背景颜色。我指的是在透明后它所具有的背景颜色。

  

如何让特定的td不从表中继承CSS样式?

还记得td没有继承你问题中提到的表的CSS规则.. td只是透明的,我们看到的背景颜色实际上是表...