如何用填充颜色覆盖 html td?
How to override html td also with padding color?
我希望单元格 d 具有全黄色背景。
我该怎么做?
我在 outlook 显示中瞄准 html。
更新 1:实际上,我正在使用敏捷 html 包在运行时更改单元格 d,并且 table 已经格式化好,出于某些原因,我只想更改单元格 d因此,在最后一步,我想使用 div 插入黄色背景而不改变它的父 td class.
最终解:https://jsfiddle.net/0khjqdh0/
<table class="XXX" >
<tr class="header">
<td>Col 1</td>
<td>Col 2</td>
</tr>
<tr class="d1">
<td>a</td>
<td>b</td>
</tr>
<tr class="d0">
<td>c
</td>
<td>
<div class="special_class"> d </div>
</td>
</tr>
</table>
.XXX table{
border:0px;
border-collapse:collapse;
padding:0px;
}
.XXX tr.header td {
font-family: Arial, Helvetica, sans-serif;
font-size: 10.0pt;
font-weight: bold;
border:1px solid #C0C0C0;
color:#FFFFFF;
background-color:#4F81BD;
border-collapse:collapse;
padding:5px;
}
.XXX tr.d0 td {
font-family: Arial, Helvetica, sans-serif;
font-size: 10.0pt;
background-color:#E1EEF4;
border:1px solid #C0C0C0;
padding:5px;
white-space:nowrap;
}
.XXX tr.d1 td {
font-family: Arial, Helvetica, sans-serif;
font-size: 10.0pt;
background-color:#FFFFFF;
border:1px solid #C0C0C0;
padding:5px;
white-space:nowrap;
}
.XXX div.special_class {
background-color:yellow;
}
尝试将 background-color:yellow;
应用于父 td 或从 td 单元格中删除填充并将该填充提供给子 div
您可以将 class 放在单元格上:
<td class="special_class">
<div> d </div>
</td>
然后在单元格上设置样式并使其足够具体以覆盖现有样式:
.XXX tr.d0 td.special_class {
background-color:yellow;
}
您只需要将 class 指定给 td
的子元素,而是指定 td
您想要更改的背景颜色:
<td class="special_class">
朋友,请检查这个 - http://jsfiddle.net/afelixj/f2pb227a/4/
.XXX div.special_class {
background-color:yellow;
padding: 5px;
margin: -5px;
}
我希望单元格 d 具有全黄色背景。
我该怎么做?
我在 outlook 显示中瞄准 html。
更新 1:实际上,我正在使用敏捷 html 包在运行时更改单元格 d,并且 table 已经格式化好,出于某些原因,我只想更改单元格 d因此,在最后一步,我想使用 div 插入黄色背景而不改变它的父 td class.
最终解:https://jsfiddle.net/0khjqdh0/
<table class="XXX" >
<tr class="header">
<td>Col 1</td>
<td>Col 2</td>
</tr>
<tr class="d1">
<td>a</td>
<td>b</td>
</tr>
<tr class="d0">
<td>c
</td>
<td>
<div class="special_class"> d </div>
</td>
</tr>
</table>
.XXX table{
border:0px;
border-collapse:collapse;
padding:0px;
}
.XXX tr.header td {
font-family: Arial, Helvetica, sans-serif;
font-size: 10.0pt;
font-weight: bold;
border:1px solid #C0C0C0;
color:#FFFFFF;
background-color:#4F81BD;
border-collapse:collapse;
padding:5px;
}
.XXX tr.d0 td {
font-family: Arial, Helvetica, sans-serif;
font-size: 10.0pt;
background-color:#E1EEF4;
border:1px solid #C0C0C0;
padding:5px;
white-space:nowrap;
}
.XXX tr.d1 td {
font-family: Arial, Helvetica, sans-serif;
font-size: 10.0pt;
background-color:#FFFFFF;
border:1px solid #C0C0C0;
padding:5px;
white-space:nowrap;
}
.XXX div.special_class {
background-color:yellow;
}
尝试将 background-color:yellow;
应用于父 td 或从 td 单元格中删除填充并将该填充提供给子 div
您可以将 class 放在单元格上:
<td class="special_class">
<div> d </div>
</td>
然后在单元格上设置样式并使其足够具体以覆盖现有样式:
.XXX tr.d0 td.special_class {
background-color:yellow;
}
您只需要将 class 指定给 td
的子元素,而是指定 td
您想要更改的背景颜色:
<td class="special_class">
朋友,请检查这个 - http://jsfiddle.net/afelixj/f2pb227a/4/
.XXX div.special_class {
background-color:yellow;
padding: 5px;
margin: -5px;
}