html - 如何将类名添加到所有“%th”
问题描述
我想编辑表格的行内容(添加填充等)。如果我将类名放在“%tr”中,什么也不会发生。但是当我把它放在“%th”中时,它就起作用了。当然,我不能对每个人都这样做,因为我认为这不是一个好习惯。那么我该怎么做才能将所有“%th”放在同一个类中而不复制粘贴 15 次呢?
%div{:style => "overflow-x:auto;"}
%table{:class => "students_table", :border => "1"}
%thead
%tr
%th{:class => "student_table2"} Registration Number
%th Forename
%th Surname
%th Programme Code
%th Deptcode
%th Personaltutor
%th Periodofstudy
%th Access
%th Contact
%th Teaching
%th Exams
%th Practicals
%th Circumstances
%th Recommendations
%th Last updated at
解决方案
您可以选择 tr 的直接子代,然后应用您的规则
tr > th {
color:red;
}
推荐阅读
- reactjs - 状态更新错误
- node.js - 如何设置 Socket.io 以使用 Express NodeJS 监听单独的页面
- debugging - 在 GoLand 的控制台中运行 termbox-go 应用程序
- arrays - JSON Parse 错误:无法在 React Native 中解析 JSON 字符串
- php - Woocommerce:在商店页面使用图库图片作为产品图片
- r - 如何从基础模拟函数?
- mysql - 在 codeigniter 中使用 csv_from_result 创建自定义列
- regex - 正则表达式用逗号分隔字符串,忽略函数语法
- angular - 角度材料:扩展 MatPaginator 而不创建重复分页器
- android - 如何将 Web 应用程序与应用程序之间连接起来?