是否可以使用colpan保存col
背景色?在下面的示例中,即使我使用colspan="3"
,我也希望在空格中获得最后一个col的黄色。
请看看上面的图片,我想使用colspan="3"
谢谢!
table,
th,
td {
border: 1px solid black;
}
<table>
<colgroup>
<col span="2" style="background-color:#E6E6DC">
<col style="background-color:yellow">
</colgroup>
<tr>
<th>ISBN</th>
<th>Title</th>
<th>Price</th>
</tr>
<tr>
<td colspan="3">Error descriotion, last col should be yellow</td>
</tr>
<tr>
<td>5869207</td>
<td>My first CSS</td>
<td>$49</td>
</tr>
</table>
答案 0 :(得分:1)
- ,我想在最后一个col的空间中获得黄色
即使我使用colspan =&#34; 3&#34;
好的,我砍掉了那3个大的行,现在最后一列是黄色的。好的,保持在
colspan='3'
的中间行,并使用<mark>
来保存<td>
中的样式。请参阅更新的代码段。
<!DOCTYPE html>
<html>
<head>
<style>
table,
th,
td {
border: 1px solid black;
}
</style>
</head>
<body>
<table style='border-collapse:collapse;table-layout:fixed;width:325px;'>
<colgroup>
<col span="2" style="background-color:red">
<col span='1' style="background-color:yellow">
</colgroup>
<tr>
<th>ISBN</th>
<th>Title</th>
<th>Price</th>
</tr>
<tr>
<td colspan='3' style='padding:0'>Error description, last col should
<mark style='line-height:1.2;width:12.25ex;border-right:1.75px solid yellow;border-left:3.75px solid yellow;display:inline-block;padding:0 12px 0 2px;position:relative; left: 3px;'> be yellow</mark>
</td>
</tr>
<tr>
<td>5869207</td>
<td>My first CSS</td>
<td>$49</td>
</tr>
</table>
</body>
</html>
&#13;
答案 1 :(得分:1)
你可以添加一个&#34; id&#34;你的td colspan,
<td colspan="3" id="your id here">Error descriotion, last col should be yellow</td>
并将其添加到css
#your id here{
background-color: yellow;
}
答案 2 :(得分:0)
尝试将一个类添加到col并为colspan应用相同的样式。
public interface ISingleFingerHandler
{
void OnSingleFingerDown (Vector2 position);
void OnSingleFingerUp (Vector2 position);
void OnSingleFingerDrag (Vector2 delta);
}
public class SingleFingerInputModule:MonoBehaviour,
IPointerDownHandler,IPointerUpHandler,IDragHandler