[英]Capitalize all first letters in a table except for the last row using CSS
The below CSS code capitalizes every first letter of the first row in the table. 下面的CSS代码将表中第一行的每个首字母大写。 However, I don't want the very last row to be have its first letter capitalized.
但是,我不希望最后一行的首字母大写。 I have tried using the
:not()
selector with no success. 我尝试使用
:not()
选择器没有成功。 Any idea's? 有任何想法吗?
table tr td:first-child::first-letter {
font-size:30px;
}
Try :not(:last-child)
on the tr
: 在
tr
上尝试:not(:last-child)
:
table tr:not(:last-child) td:first-child::first-letter { text-transform: uppercase; }
<table> <tr><td>ab</td><td>cd</td><td>ef</td></tr> <tr><td>ab</td><td>cd</td><td>ef</td></tr> <tr><td>ab</td><td>cd</td><td>ef</td></tr> </table>
Hi you can use the css directive text-transform setted capitalize 嗨,您可以使用css指令将text-transform设置为大写
so your css will be 所以你的CSS将是
table tr td:first-letter{
text-transform:capitalize;
}
to avoid that last row will be affected you can use the pseudo selector :last-child 为了避免最后一行受到影响,您可以使用伪选择器:last-child
table tr:last-child td:first-letter{
text-transform:none;
}
声明:本站的技术帖子网页,遵循CC BY-SA 4.0协议,如果您需要转载,请注明本站网址或者原文地址。任何问题请咨询:yoyou2525@163.com.