Html 使用标记id进行CSS重构
我对CSS选择器没有很好的理解。 我知道下面的CSS是稀疏的,但它会让我去 我希望th和td的表格边框相同Html 使用标记id进行CSS重构,html,css,Html,Css,我对CSS选择器没有很好的理解。 我知道下面的CSS是稀疏的,但它会让我去 我希望th和td的表格边框相同 #eventRegistrationNotificationEmail th{ width:25%; border: 1px solid #999999; } #eventRegistrationNotificationEmail td{ width:75%; border: 1px solid #999999; } 我知道我可以做下面的事情,但是我如何用ID或类来
#eventRegistrationNotificationEmail th{
width:25%;
border: 1px solid #999999;
}
#eventRegistrationNotificationEmail td{
width:75%;
border: 1px solid #999999;
}
我知道我可以做下面的事情,但是我如何用ID或类来做呢
td, th{
border: 1px solid #999999;
}
你可以用完全相同的方法来做,只要用逗号分隔选择器,样式就会应用到所有选择器上
#eventRegistrationNotificationEmail td,
#eventRegistrationNotificationEmail th {
border: 1px solid #999999;
}
您还可以使用CSS预处理器,例如,它允许您在.less
文件中创建下一个样式,这些样式在处理器运行时组合在一起:
#eventRegistrationNotificationEmail {
td, th {
border: 1px solid #999999;
}
}
你可以用完全相同的方法来做,只要用逗号分隔选择器,样式就会应用到所有选择器上
#eventRegistrationNotificationEmail td,
#eventRegistrationNotificationEmail th {
border: 1px solid #999999;
}
您还可以使用CSS预处理器,例如,它允许您在.less
文件中创建下一个样式,这些样式在处理器运行时组合在一起:
#eventRegistrationNotificationEmail {
td, th {
border: 1px solid #999999;
}
}
我意识到“eventRegistrationNotificationEmail”是您的表id:
table#eventRegistrationNotificationEmail th, table#eventRegistrationNotificationEmail td{
border: 1px solid #999999;
}
我意识到“eventRegistrationNotificationEmail”是您的表id:
table#eventRegistrationNotificationEmail th, table#eventRegistrationNotificationEmail td{
border: 1px solid #999999;
}
去读,去读,现在我明白是什么绊倒了我。我看你必须完全符合每个标签的要求。我认为“少一点”这件事现在对我来说有点先进,但我会记得调查一下。现在我明白是什么让我绊倒了。我看你必须完全符合每个标签的要求。我认为“少一点”这件事现在对我来说有点先进,但我会记得研究一下。