【问题标题】:Can i mention multiple TAG before class in HTML? [duplicate]我可以在 HTML 课前提到多个标签吗? [复制]
【发布时间】:2020-10-23 20:04:35
【问题描述】:

我只是想知道我可以在上课前提到多个标签来缩短我的代码。我已经做好了表格,想为<th>,<td>,<table>做边框,只需要在课前提到它。

现在:

table.maintable{    
    opacity: 87%;
    border: 2px solid black;
}

.maintable{
    opacity: 87%;
    border: 2px solid black;
}

.maintable{
    opacity: 87%;
    border: 2px solid black;
}

做这样的事情:

table.th.td.maintable{    
    opacity: 87%;
    border: 2px solid black;
}

我可以通过类而不使用id吗?

【问题讨论】:

  • 只需使用.maintable { opacity: 87%; border: 2px solid black; } 它将适用于使用该类的所有内容。不管它是什么,桌子,th 或任何东西。

标签: html css


【解决方案1】:

简单的解决方案:

table.maintable,
th.maintable,
td.maintable {
    opacity: 87%;
    border: 2px solid black;
}

【讨论】:

    猜你喜欢
    • 2021-12-18
    • 1970-01-01
    • 2021-04-18
    • 1970-01-01
    • 1970-01-01
    • 1970-01-01
    • 1970-01-01
    • 1970-01-01
    • 2018-06-11
    相关资源
    最近更新 更多