在Salesforce中,我想显示一些具有各自值的字段,但我无法通过使用CSS将单元格宽度固定为某个值。我做错了什么?
<table>
<tr><td class="scoreInformation">Text</td><td>Value</td></tr>
</table>
CSS:
.THIS scoreInformation{
width: 100px;
}
基本上,您缺少.
。正如它所写的,样式将应用于标记名为scoreInformation
的元素,而不是类名为scoreInformation
的元素。
此外,假设在闪电组件中使用此样式表,则.THIS
的使用是正确的。
最终,您将希望包括以下一项或两项:
/* for top level elements */
.THIS.scoreInformation{
width: 100px;
}
/* for non-top level elements */
.THIS .scoreInformation{
width: 100px;
}